Index: branches/unlabeled/unlabeled-1.63.2/kernel/units/users/users_event_handler.php =================================================================== diff -u -r5883 -r5911 --- branches/unlabeled/unlabeled-1.63.2/kernel/units/users/users_event_handler.php (.../users_event_handler.php) (revision 5883) +++ branches/unlabeled/unlabeled-1.63.2/kernel/units/users/users_event_handler.php (.../users_event_handler.php) (revision 5911) @@ -730,87 +730,84 @@ function OnForgotPassword(&$event){ - $user_object = &$this->Application->recallObject('u.forgot', null, Array('skip_autoload' => true)); - $user_current_object = &$this->Application->recallObject('u'); + $user_object = &$this->Application->recallObject('u.forgot', null, Array('skip_autoload' => true)); + $user_current_object = &$this->Application->recallObject('u'); - $username = $this->Application->GetVar('username'); - $email = $this->Application->GetVar('email'); - $found = false; - $allow_reset = true; + $username = $this->Application->GetVar('username'); + $email = $this->Application->GetVar('email'); + $found = false; + $allow_reset = true; - if( strlen($username) ) - { - if( $user_object->Load(array('Login'=>$username)) ) - $found = ($user_object->GetDBField("Login")==$username && $user_object->GetDBField("Status")==1) && strlen($user_object->GetDBField("Password")); - } - else if( strlen($email) ) - { - if( $user_object->Load(array('Email'=>$email)) ) - $found = ($user_object->GetDBField("Email")==$email && $user_object->GetDBField("Status")==1) && strlen($user_object->GetDBField("Password")); - } + if( strlen($username) ) + { + if( $user_object->Load(array('Login'=>$username)) ) + $found = ($user_object->GetDBField("Login")==$username && $user_object->GetDBField("Status")==1) && strlen($user_object->GetDBField("Password")); + } + else if( strlen($email) ) + { + if( $user_object->Load(array('Email'=>$email)) ) + $found = ($user_object->GetDBField("Email")==$email && $user_object->GetDBField("Status")==1) && strlen($user_object->GetDBField("Password")); + } - if( $user_object->isLoaded() ) - { - $PwResetConfirm = $user_object->GetDBField('PwResetConfirm'); - $PwRequestTime = $user_object->GetDBField('PwRequestTime'); - $PassResetTime = $user_object->GetDBField('PassResetTime'); - //$MinPwResetDelay = $user_object->GetDBField('MinPwResetDelay'); - $MinPwResetDelay = $this->Application->ConfigValue('Users_AllowReset'); + if( $user_object->isLoaded() ) + { + $PwResetConfirm = $user_object->GetDBField('PwResetConfirm'); + $PwRequestTime = $user_object->GetDBField('PwRequestTime'); + $PassResetTime = $user_object->GetDBField('PassResetTime'); + //$MinPwResetDelay = $user_object->GetDBField('MinPwResetDelay'); + $MinPwResetDelay = $this->Application->ConfigValue('Users_AllowReset'); - $allow_reset = (strlen($PwResetConfirm) ? - adodb_mktime() > $PwRequestTime + $MinPwResetDelay : - adodb_mktime() > $PassResetTime + $MinPwResetDelay); - } + $allow_reset = (strlen($PwResetConfirm) ? + adodb_mktime() > $PwRequestTime + $MinPwResetDelay : + adodb_mktime() > $PassResetTime + $MinPwResetDelay); + } - if($found && $allow_reset) - { - $this->Application->StoreVar('tmp_user_id', $user_object->GetDBField("PortalUserId")); - $this->Application->StoreVar('tmp_email', $user_object->GetDBField("Email")); - $this->Application->EmailEventUser('INCOMMERCEUSER.PSWDC', $user_object->GetDBField("PortalUserId")); + if($found && $allow_reset) + { + $this->Application->StoreVar('tmp_user_id', $user_object->GetDBField("PortalUserId")); + $this->Application->StoreVar('tmp_email', $user_object->GetDBField("Email")); + $this->Application->EmailEventUser('INCOMMERCEUSER.PSWDC', $user_object->GetDBField("PortalUserId")); + $event->redirect = $this->Application->GetVar('template_success'); + } + else + { + if(!strlen($username) && !strlen($email)) + { + $user_current_object->ErrorMsgs['forgotpw_nodata'] = $this->Application->Phrase('lu_ferror_forgotpw_nodata'); + $user_current_object->FieldErrors['Login']['pseudo'] = 'forgotpw_nodata'; + $user_current_object->FieldErrors['Email']['pseudo'] = 'forgotpw_nodata'; + } + else + { + if($allow_reset) + { + if( strlen($username) ){ + $user_current_object->ErrorMsgs['unknown_username'] = $this->Application->Phrase('lu_ferror_unknown_username'); + $user_current_object->FieldErrors['Login']['pseudo']='unknown_username'; + } + if( strlen($email) ){ + $user_current_object->ErrorMsgs['unknown_email'] = $this->Application->Phrase('lu_ferror_unknown_email'); + $user_current_object->FieldErrors['Email']['pseudo']='unknown_email'; + } + } + else + { + $user_current_object->ErrorMsgs['reset_denied'] = $this->Application->Phrase('lu_ferror_reset_denied'); + if( strlen($username) ){ + $user_current_object->FieldErrors['Login']['pseudo']='reset_denied'; + } + if( strlen($email) ){ + $user_current_object->FieldErrors['Email']['pseudo']='reset_denied'; + } + } + } - $event->redirect = $this->Application->GetVar('template_success'); + if($user_current_object->FieldErrors){ + $event->redirect = false; + } + } - } - else - { - if(!strlen($username) && !strlen($email)) - { - $user_current_object->ErrorMsgs['forgotpw_nodata'] = $this->Application->Phrase('lu_ferror_forgotpw_nodata'); - $user_current_object->FieldErrors['Login']['pseudo'] = 'lu_ferror_forgotpw_nodata'; - } - else - { - - if($allow_reset) - { - if( strlen($username) ){ - $user_current_object->ErrorMsgs['unknown_username'] = $this->Application->Phrase('lu_ferror_unknown_username'); - $user_current_object->FieldErrors['Login']['pseudo']='unknown_username'; - } - if( strlen($email) ){ - $user_current_object->ErrorMsgs['unknown_email'] = $this->Application->Phrase('lu_ferror_unknown_email'); - $user_current_object->FieldErrors['Email']['pseudo']='unknown_email'; - } - } - else - { - $user_current_object->ErrorMsgs['reset_denied'] = $this->Application->Phrase('lu_ferror_reset_denied'); - if( strlen($username) ){ - $user_current_object->FieldErrors['Login']['pseudo']='reset_denied'; - } - if( strlen($email) ){ - $user_current_object->FieldErrors['Email']['pseudo']='reset_denied'; - } - } - - } - - if($user_current_object->FieldErrors){ - $event->redirect = false; - } - } - } /**