Skip to content
Snippets Groups Projects
Commit d37740d7 authored by Tim Steiner's avatar Tim Steiner
Browse files

Throw an exception when calling Auth_UserModel::getCurrentUser() if no user is logged in.

parent 2e788e05
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ class Auth_UserModel extends Unl_Model {
}
$records = $db->query($select)->fetchAll();
$objects = new Unl_Model_Collection('Auth_UserModel');
$objects = new Unl_Model_Collection(__CLASS__);
foreach ($records as $record) {
$object = Unl_Model_Registry::getInstance()->getOrAdd(new self($record));
$objectId = $object->getId();
......@@ -78,8 +78,9 @@ class Auth_UserModel extends Unl_Model {
public static function findCurrentUser()
{
$username = Zend_Auth::getInstance()->getIdentity();
var_dump($username);
if (!$username) {
return null;
throw new Exception('You must be logged in to view this page.');
}
return self::findByUsername($username);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment