Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setAdminAuthenticate(const string& path, const string& login, const string& password)
- {
- if (Adminstrator::adminID == 0)
- {
- throw exception("Error! You are not registered in the system!");
- }
- else
- {
- Adminstrator dmn;
- fstream fs;
- fs.open(path, fstream::in | fstream::out | fstream::app);
- if (!fs.is_open())
- {
- throw file_not_found("Error! File not found!");
- }
- else
- {
- fs.read((char*)& dmn, sizeof(Adminstrator));
- if (dmn.login == login and dmn.password == password)
- {
- m_login = dmn.login;
- m_password = dmn.password;
- }
- else
- {
- throw exception("Error! You entered incorrectly login or password!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment