Fixed avatar url when logging in

This commit is contained in:
kolaente 2019-06-06 12:28:08 +02:00
parent 7f5a6e338c
commit 4e8c2a7bf6
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -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")))