#include <bits/stdc++.h>
using namespace std;
class User
{
public:
int userid;
static int allusers;
string email, password;
bool isLoggedIn;
User(string email, string password)
{
this->email = email;
this->password = password;
this->userid = ++allusers;
this->isLoggedIn = false;
}
void login(string email, string password)
{
if (this->email == email && this->password == password)
{
cout << "Login successful\n";
isLoggedIn = true;
}
else if (this->email == email)
{
cout << "Wrong password\n";
}
else
{
cout << "Wrong email\n";
}
}
void logout()
{
if (isLoggedIn)
{
cout << "User with email " << email << " has logged out.\n";
isLoggedIn = false;
}
else
{
cout << "User is not logged in.\n";
}
}
void changepassword(string oldPassword, string newPassword)
{
if (this->password == oldPassword)
{
this->password = newPassword;
cout << "Password changed successfully.\n";
}
else
{
cout << "Old password is wrong\n";
}
}
};
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgpjbGFzcyBVc2VyCnsKcHVibGljOgogICAgaW50IHVzZXJpZDsKICAgIHN0YXRpYyBpbnQgYWxsdXNlcnM7CiAgICBzdHJpbmcgZW1haWwsIHBhc3N3b3JkOwogICAgYm9vbCBpc0xvZ2dlZEluOwoKICAgIFVzZXIoc3RyaW5nIGVtYWlsLCBzdHJpbmcgcGFzc3dvcmQpCiAgICB7CiAgICAgICAgdGhpcy0+ZW1haWwgPSBlbWFpbDsKICAgICAgICB0aGlzLT5wYXNzd29yZCA9IHBhc3N3b3JkOwogICAgICAgIHRoaXMtPnVzZXJpZCA9ICsrYWxsdXNlcnM7CiAgICAgICAgdGhpcy0+aXNMb2dnZWRJbiA9IGZhbHNlOwogICAgfQoKICAgIHZvaWQgbG9naW4oc3RyaW5nIGVtYWlsLCBzdHJpbmcgcGFzc3dvcmQpCiAgICB7CiAgICAgICAgaWYgKHRoaXMtPmVtYWlsID09IGVtYWlsICYmIHRoaXMtPnBhc3N3b3JkID09IHBhc3N3b3JkKQogICAgICAgIHsKICAgICAgICAgICAgY291dCA8PCAiTG9naW4gc3VjY2Vzc2Z1bFxuIjsKICAgICAgICAgICAgaXNMb2dnZWRJbiA9IHRydWU7CiAgICAgICAgfQogICAgICAgIGVsc2UgaWYgKHRoaXMtPmVtYWlsID09IGVtYWlsKQogICAgICAgIHsKICAgICAgICAgICAgY291dCA8PCAiV3JvbmcgcGFzc3dvcmRcbiI7CiAgICAgICAgfQogICAgICAgIGVsc2UKICAgICAgICB7CiAgICAgICAgICAgIGNvdXQgPDwgIldyb25nIGVtYWlsXG4iOwogICAgICAgIH0KICAgIH0KCiAgICB2b2lkIGxvZ291dCgpCiAgICB7CiAgICAgICAgaWYgKGlzTG9nZ2VkSW4pCiAgICAgICAgewogICAgICAgICAgICBjb3V0IDw8ICJVc2VyIHdpdGggZW1haWwgIiA8PCBlbWFpbCA8PCAiIGhhcyBsb2dnZWQgb3V0LlxuIjsKICAgICAgICAgICAgaXNMb2dnZWRJbiA9IGZhbHNlOwogICAgICAgIH0KICAgICAgICBlbHNlCiAgICAgICAgewogICAgICAgICAgICBjb3V0IDw8ICJVc2VyIGlzIG5vdCBsb2dnZWQgaW4uXG4iOwogICAgICAgIH0KICAgIH0KCiAgICB2b2lkIGNoYW5nZXBhc3N3b3JkKHN0cmluZyBvbGRQYXNzd29yZCwgc3RyaW5nIG5ld1Bhc3N3b3JkKQogICAgewogICAgICAgIGlmICh0aGlzLT5wYXNzd29yZCA9PSBvbGRQYXNzd29yZCkKICAgICAgICB7CiAgICAgICAgICAgIHRoaXMtPnBhc3N3b3JkID0gbmV3UGFzc3dvcmQ7CiAgICAgICAgICAgIGNvdXQgPDwgIlBhc3N3b3JkIGNoYW5nZWQgc3VjY2Vzc2Z1bGx5LlxuIjsKICAgICAgICB9CiAgICAgICAgZWxzZQogICAgICAgIHsKICAgICAgICAgICAgY291dCA8PCAiT2xkIHBhc3N3b3JkIGlzIHdyb25nXG4iOwogICAgICAgIH0KICAgIH0KfTs=