Only load the remote gravatar image if the server can talk to the outside world

This commit is contained in:
snipe 2016-09-07 01:41:23 -07:00
parent a8f79369ee
commit aa0ccf11fa

View file

@ -9,6 +9,7 @@ use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Watson\Validating\ValidatingTrait;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Http\Traits\UniqueUndeletedTrait;
use App\Models\Setting;
class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
@ -146,10 +147,8 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
return config('app.url').'/uploads/avatars/'.$this->avatar;
}
if ($this->email) {
// Generate the Gravatar hash
if ((Setting::getSettings()->load_remote=='1') && ($this->email!='')) {
$gravatar = md5(strtolower(trim($this->email)));
// Return the Gravatar url
return "//gravatar.com/avatar/".$gravatar;
}