Index: trunk/core/units/users/users_event_handler.php =================================================================== diff -u -r1609 -r1677 --- trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 1609) +++ trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 1677) @@ -33,16 +33,22 @@ $object->Load($user_id); if( $object->GetDBField('Status') == STATUS_ACTIVE ) { - $session =& $this->Application->recallObject('Session'); - $session->SetField('PortalUserId', $user_id); - $this->Application->SetVar('u_id', $user_id); - $this->Application->StoreVar('user_id', $user_id); - $sql = 'SELECT DISTINCT GroupId FROM '.TABLE_PREFIX.'UserGroup WHERE PortalUserId = '.$user_id; - if( $groups = $this->Conn->GetCol($sql) ) + if( $groups = $this->Conn->GetCol($sql) ) $this->Application->StoreVar( 'UserGroups', implode(',', $groups) ); + + if( $this->Application->CheckPermission('LOGIN',0) ) { - $this->Application->StoreVar( 'UserGroups', implode(',', $groups) ); + $session =& $this->Application->recallObject('Session'); + $session->SetField('PortalUserId', $user_id); + $this->Application->SetVar('u_id', $user_id); + $this->Application->StoreVar('user_id', $user_id); } + else + { + $object->Load(-2); + $object->SetError('ValidateLogin', 'no_permission', 'lu_no_permissions'); + $event->status = erFAIL; + } $next_template = $this->Application->GetVar('next_template'); if($next_template) $event->redirect = $next_template;