mirror of
https://github.com/thomiceli/opengist.git
synced 2024-12-23 04:52:40 +00:00
Fix empty invitation on user creation (#247)
This commit is contained in:
parent
572e834999
commit
57273946c3
1 changed files with 5 additions and 3 deletions
|
@ -63,7 +63,7 @@ func processRegister(ctx echo.Context) error {
|
||||||
invitation, err := db.GetInvitationByCode(code)
|
invitation, err := db.GetInvitationByCode(code)
|
||||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
return errorRes(500, "Cannot check for invitation code", err)
|
return errorRes(500, "Cannot check for invitation code", err)
|
||||||
} else if invitation != nil && invitation.IsUsable() {
|
} else if invitation.ID != 0 && invitation.IsUsable() {
|
||||||
disableSignup = false
|
disableSignup = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,9 +113,11 @@ func processRegister(ctx echo.Context) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if invitation.ID != 0 {
|
||||||
if err := invitation.Use(); err != nil {
|
if err := invitation.Use(); err != nil {
|
||||||
return errorRes(500, "Cannot use invitation", err)
|
return errorRes(500, "Cannot use invitation", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sess.Values["user"] = user.ID
|
sess.Values["user"] = user.ID
|
||||||
saveSession(sess, ctx)
|
saveSession(sess, ctx)
|
||||||
|
|
Loading…
Reference in a new issue