Fixed avatar url when logging in
This commit is contained in:
parent
7f5a6e338c
commit
4e8c2a7bf6
1 changed files with 1 additions and 4 deletions
|
@ -19,8 +19,6 @@ package v1
|
||||||
import (
|
import (
|
||||||
"code.vikunja.io/api/pkg/models"
|
"code.vikunja.io/api/pkg/models"
|
||||||
"code.vikunja.io/web/handler"
|
"code.vikunja.io/web/handler"
|
||||||
"crypto/md5"
|
|
||||||
"encoding/hex"
|
|
||||||
"github.com/dgrijalva/jwt-go"
|
"github.com/dgrijalva/jwt-go"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
@ -76,8 +74,7 @@ func CreateNewJWTTokenForUser(user *models.User) (token string, err error) {
|
||||||
claims["id"] = user.ID
|
claims["id"] = user.ID
|
||||||
claims["exp"] = time.Now().Add(time.Hour * 72).Unix()
|
claims["exp"] = time.Now().Add(time.Hour * 72).Unix()
|
||||||
|
|
||||||
avatar := md5.Sum([]byte(user.Email))
|
claims["avatar"] = user.AvatarURL
|
||||||
claims["avatar"] = hex.EncodeToString(avatar[:])
|
|
||||||
|
|
||||||
// Generate encoded token and send it as response.
|
// Generate encoded token and send it as response.
|
||||||
return t.SignedString([]byte(viper.GetString("service.JWTSecret")))
|
return t.SignedString([]byte(viper.GetString("service.JWTSecret")))
|
||||||
|
|
Loading…
Reference in a new issue