added: flag has_pass to User structure

if false that means the user has not set a password yet 
       (this can be used by a plugins to create a new account without a password set)
       in order to login the user first has to set a new password
       (this can be done from a some kind of activation link send via email etc)
       



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@954 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2014-06-07 11:20:44 +00:00
parent 222955a2e7
commit 01892d2766
9 changed files with 60 additions and 26 deletions

View File

@@ -139,6 +139,7 @@ return true;
*/
bool AddUser::AddNewUser(User & user, const std::wstring & pass)
{
up.has_pass = true;
up.pass = pass;
system->crypt.PassHashCrypt(up);

View File

@@ -91,7 +91,15 @@ bool result;
if( db->GetUserPass(login, user_id, up) )
{
result = CheckPasswords(password);
if( up.has_pass )
{
result = CheckPasswords(password);
}
else
{
log << log2 << "Login: this account has not a password set yet" << logend;
result = false;
}
}
else
{

View File

@@ -85,6 +85,7 @@ bool result = false;
if( puser )
{
up.has_pass = true;
up.pass = new_password;
system->crypt.PassHashCrypt(up);
result = (db->ChangeUserPass(user_id, up) == WINIX_ERR_OK);