mirror of
https://github.com/thomiceli/opengist.git
synced 2024-12-22 20:42: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,8 +113,10 @@ func processRegister(ctx echo.Context) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := invitation.Use(); err != nil {
|
if invitation.ID != 0 {
|
||||||
return errorRes(500, "Cannot use invitation", err)
|
if err := invitation.Use(); err != nil {
|
||||||
|
return errorRes(500, "Cannot use invitation", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sess.Values["user"] = user.ID
|
sess.Values["user"] = user.ID
|
||||||
|
|
Loading…
Reference in a new issue