fix: delete challenges after they have been used

This commit is contained in:
Derrick Hammer 2024-01-16 15:48:45 -05:00
parent 9cc05b3096
commit f8d0dc6787
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 14 additions and 0 deletions

View File

@ -352,6 +352,13 @@ func (h *HttpHandler) AccountRegister(jc jape.Context) {
return
}
result = h.portal.Database().Delete(&challenge)
if result.Error != nil {
errored(errAccountRegisterErr)
return
}
setAuthCookie(jwt, jc)
}
@ -482,6 +489,13 @@ func (h *HttpHandler) AccountLogin(jc jape.Context) {
return
}
result = h.portal.Database().Delete(&challenge)
if result.Error != nil {
errored(errAccountLoginErr)
return
}
setAuthCookie(jwt, jc)
}