When disabling third-party deps, don't use Gravatar.

Fixes #2810
This commit is contained in:
James Brooks
2017-12-03 17:34:59 +00:00
parent beb0d42e9b
commit 8e1c9801fb
9 changed files with 254 additions and 18 deletions

View File

@@ -12,18 +12,20 @@
namespace CachetHQ\Cachet\Models;
use AltThree\Validator\ValidatingTrait;
use CachetHQ\Cachet\Presenters\UserPresenter;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Hash;
use McCool\LaravelAutoPresenter\HasPresenter;
/**
* This is the user model.
*
* @author James Brooks <james@alt-three.com>
*/
class User extends Authenticatable
class User extends Authenticatable implements HasPresenter
{
use Notifiable, ValidatingTrait;
@@ -162,18 +164,6 @@ class User extends Authenticatable
return $this;
}
/**
* Returns a Gravatar URL for the users email address.
*
* @param int $size
*
* @return string
*/
public function getGravatarAttribute($size = 200)
{
return sprintf('https://www.gravatar.com/avatar/%s?size=%d', md5(strtolower($this->email)), $size);
}
/**
* Find by api_key, or throw an exception.
*
@@ -220,4 +210,14 @@ class User extends Authenticatable
{
return trim($this->google_2fa_secret) !== '';
}
/**
* Get the presenter class.
*
* @return string
*/
public function getPresenterClass()
{
return UserPresenter::class;
}
}