mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 09:00:10 +00:00
invite: fix email confirmation jwt
same issue as with auth.go, expiry was a string causing the library to see it as expired.
This commit is contained in:
parent
1bfec54c93
commit
412fe31da6
2
api.go
2
api.go
@ -418,7 +418,7 @@ func (app *appContext) newUser(req newUserDTO, confirmed bool) (f errorFunc, suc
|
||||
"username": req.Username,
|
||||
"password": req.Password,
|
||||
"telegramPIN": req.TelegramPIN,
|
||||
"exp": strconv.FormatInt(time.Now().Add(time.Hour*12).Unix(), 10),
|
||||
"exp": time.Now().Add(time.Hour * 12).Unix(),
|
||||
"type": "confirmation",
|
||||
}
|
||||
tk := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
|
||||
|
@ -100,7 +100,7 @@ func migrateEmailStorage(app *appContext) error {
|
||||
case map[string]interface{}:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("Email address was type %T, not string: \"%+v\"\n", addr, addr)
|
||||
return fmt.Errorf("email address was type %T, not string: \"%+v\"\n", addr, addr)
|
||||
}
|
||||
}
|
||||
config, err := ini.Load(app.configPath)
|
||||
|
3
views.go
3
views.go
@ -4,7 +4,6 @@ import (
|
||||
"html/template"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -249,7 +248,7 @@ func (app *appContext) InviteProxy(gc *gin.Context) {
|
||||
return
|
||||
}
|
||||
claims, ok := token.Claims.(jwt.MapClaims)
|
||||
expiryUnix, err := strconv.ParseInt(claims["exp"].(string), 10, 64)
|
||||
expiryUnix := int64(claims["exp"].(float64))
|
||||
if err != nil {
|
||||
fail()
|
||||
app.err.Printf("Failed to parse key expiry: %s", err)
|
||||
|
Loading…
Reference in New Issue
Block a user