Updating modules/backend/models

This commit is contained in:
Stefan Talen 2014-10-11 00:04:51 +02:00
parent 6ccf49bdd9
commit 07a0a7e428
4 changed files with 16 additions and 12 deletions

View File

@ -37,5 +37,4 @@ class AccessLog extends Model
return $record;
}
}

View File

@ -66,8 +66,9 @@ class User extends UserBase
// return parent::getPersistCode();
// Option B:
if (!$this->persist_code)
if (!$this->persist_code) {
return parent::getPersistCode();
}
return $this->persist_code;
}
@ -77,19 +78,24 @@ class User extends UserBase
*/
public function getAvatarThumb($size = 25, $default = null)
{
if ($this->avatar)
if ($this->avatar) {
return $this->avatar->getThumb($size, $size);
else
return '//www.gravatar.com/avatar/' . md5(strtolower(trim($this->email))) . '?s='.$size.'&d='.urlencode($default);
} else {
return '//www.gravatar.com/avatar/'.
md5(strtolower(trim($this->email))) .
'?s='. $size .
'&d='. urlencode($default);
}
}
public function afterCreate()
{
$this->restorePurgedValues();
if ($this->send_invite)
if ($this->send_invite) {
$this->sendInvitation();
}
}
public function sendInvitation()
{
@ -100,10 +106,8 @@ class User extends UserBase
'link' => Backend::url('backend'),
];
Mail::send('backend::mail.invite', $data, function($message)
{
Mail::send('backend::mail.invite', $data, function ($message) {
$message->to($this->email, $this->full_name);
});
}
}

View File

@ -31,8 +31,9 @@ class UserPreferences extends PreferencesBase
public function resolveUser($user)
{
$user = BackendAuth::getUser();
if (!$user)
if (!$user) {
throw new SystemException(trans('backend::lang.user.preferences.not_authenticated'));
}
return $user;
}