Index: trunk/core/units/users/users_event_handler.php =================================================================== diff -u -N -r5514 -r6093 --- trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 5514) +++ trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6093) @@ -85,7 +85,7 @@ function OnSessionExpire() { if( $this->Application->IsAdmin() ) { - $this->Application->Redirect('index', Array('expired' => 1), '', 'index4.php'); + $this->Application->Redirect('index', Array('expired' => 1), '', 'index.php'); } else { $http_query =& $this->Application->recallObject('HTTPQuery'); @@ -115,7 +115,7 @@ } $email_as_login = $this->Application->ConfigValue('Email_As_Login'); - list($login_field, $submit_field) = $email_as_login ? Array('Email', 'email') : Array('Login', 'login'); + list($login_field, $submit_field) = $email_as_login && !$this->Application->IsAdmin() ? Array('Email', 'email') : Array('Login', 'login'); $login_value = $this->Application->GetVar($submit_field); if ($this->Application->IsAdmin() && ($login_value == 'root')) { @@ -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; - } - } - } /** @@ -1017,6 +1014,20 @@ $this->Application->StoreVar('force_tab', $force_tab); } } + + /** + * Overwritten to return user from order by special .ord + * + * @param kEvent $event + */ + function getPassedId(&$event) + { + if ($event->Special == 'ord') { + $order =& $this->Application->recallObject('ord'); + return $order->GetDBField('PortalUserId'); + } + return parent::getPassedID($event); + } } ?> \ No newline at end of file