Skip to content

Commit

Permalink
feat: supports default avatar when gravatar is missing (#2478)
Browse files Browse the repository at this point in the history
  • Loading branch information
amir20 authored Nov 7, 2023
1 parent 75cf2f0 commit 4380681
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/auth/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"crypto/sha256"
"encoding/hex"
"fmt"
"net/http"
"os"

Expand All @@ -22,7 +23,7 @@ type User struct {
func newUser(username, email, name string) *User {
avatar := ""
if email != "" {
avatar = "https://gravatar.com/avatar/" + hashEmail(email)
avatar = fmt.Sprintf("https://gravatar.com/avatar/%s?d=https%%3A%%2F%%2Fui-avatars.com%%2Fapi%%2F/%s/128", hashEmail(email), name)
}
return &User{
Username: username,
Expand Down

0 comments on commit 4380681

Please sign in to comment.