|
|
@ -10,6 +10,7 @@ import ( |
|
|
|
"path" |
|
|
|
"path" |
|
|
|
"strconv" |
|
|
|
"strconv" |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
|
|
|
|
"sync" |
|
|
|
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/models/db" |
|
|
|
"code.gitea.io/gitea/models/db" |
|
|
|
"code.gitea.io/gitea/modules/base" |
|
|
|
"code.gitea.io/gitea/modules/base" |
|
|
@ -31,16 +32,24 @@ func init() { |
|
|
|
db.RegisterModel(new(EmailHash)) |
|
|
|
db.RegisterModel(new(EmailHash)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ( |
|
|
|
|
|
|
|
defaultAvatarLink string |
|
|
|
|
|
|
|
once sync.Once |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
// DefaultAvatarLink the default avatar link
|
|
|
|
// DefaultAvatarLink the default avatar link
|
|
|
|
func DefaultAvatarLink() string { |
|
|
|
func DefaultAvatarLink() string { |
|
|
|
|
|
|
|
once.Do(func() { |
|
|
|
u, err := url.Parse(setting.AppSubURL) |
|
|
|
u, err := url.Parse(setting.AppSubURL) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error("GetUserByEmail: %v", err) |
|
|
|
log.Error("Can not parse AppSubURL: %v", err) |
|
|
|
return "" |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
u.Path = path.Join(u.Path, "/assets/img/avatar_default.png") |
|
|
|
u.Path = path.Join(u.Path, "/assets/img/avatar_default.png") |
|
|
|
return u.String() |
|
|
|
defaultAvatarLink = u.String() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return defaultAvatarLink |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// HashEmail hashes email address to MD5 string. https://en.gravatar.com/site/implement/hash/
|
|
|
|
// HashEmail hashes email address to MD5 string. https://en.gravatar.com/site/implement/hash/
|
|
|
|