fix: delete challenges after they have been used
This commit is contained in:
parent
9cc05b3096
commit
f8d0dc6787
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue