fix: if pubkey isnt registered, error
This commit is contained in:
parent
f8d0dc6787
commit
d237b42314
|
@ -43,6 +43,7 @@ var (
|
|||
errEmailAlreadyExists = errors.New("Email already exists")
|
||||
errGeneratingPassword = errors.New("Error generating password")
|
||||
errPubkeyAlreadyExists = errors.New("Pubkey already exists")
|
||||
errPubkeyNotExist = errors.New("Pubkey does not exist")
|
||||
errAccountLoginErr = errors.New(errAccountLogin)
|
||||
)
|
||||
|
||||
|
@ -394,6 +395,13 @@ func (h *HttpHandler) AccountLoginChallenge(jc jape.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
pubkeyExists, _ := h.portal.Accounts().PubkeyExists(hex.EncodeToString(decodedKey[1:]))
|
||||
|
||||
if pubkeyExists {
|
||||
errored(errPubkeyNotExist)
|
||||
return
|
||||
}
|
||||
|
||||
result := h.portal.Database().Create(&models.S5Challenge{
|
||||
Challenge: base64.RawURLEncoding.EncodeToString(challenge),
|
||||
Type: "login",
|
||||
|
|
Loading…
Reference in New Issue