-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFaculty.cpp
75 lines (66 loc) · 1.96 KB
/
Faculty.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <iostream>
#include <cstring>
#include <bits/stdc++.h>
#ifdef WIN32
#include <ncurses/ncurses.h>
#else
#include <ncurses.h>
#endif
#include "Faculty.h"
#include "OfficeOfAcademics.h"
#define SUCCESSFUL 1
#define YES 1
#define NO 0
int count2=0;
void LOGINSTART();
void Faculty :: login()
{
char ldap[40], pass[40];
std::cout << "Enter LDAP ID: ";
std::cin >> ldap;
initscr(); // enable ncurses
printw("Enter Password: ");
noecho(); // disable character echoing
getnstr(pass,sizeof(pass));
echo(); // enable character echoing again
// getch(); // Wait for a keypress
endwin(); // disable ncurses
// std::cout << std::endl;
int loginverify = OfficeOfAcademics::VerifyCredentials(ldap, pass);
if (loginverify == SUCCESSFUL)
{
std::cout << ("\n** Login Successful! **\n\n");
FurtherOptions();
}
else
{
std::cout << ("Enter credentials again\n");
count2++;
if(count2==3)
{
printf("You have entered the wrong credentials three times\n\n");
::LOGINSTART();
}
login();
}
}
void Faculty::FurtherOptions()
{
int repeat = YES;
while(repeat == YES)
{
std::cout << ("Enter the Roll Number of the student to retrieve Medical Leave Record: ");
char roll[15];
std::cin >> roll;
OfficeOfAcademics::GetMedicalLeaveRecord(roll);
std::cout << "\n\nDo you wish to check for another student? (Yes/No): ";
std::string response;
std::cin >> response;
std::transform(response.begin(), response.end(), response.begin(), ::tolower);
if(response.std::string::compare("yes")==0)
{
repeat = YES;
}
else repeat = NO;
}
}