refactor: update usage of account methods

This commit is contained in:
Derrick Hammer 2024-02-13 19:29:37 -05:00
parent bbb68aecb5
commit 3e629cf46e
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 5 deletions

View File

@ -405,14 +405,14 @@ func (h *HttpHandler) accountRegister(jc jape.Context) {
return
}
accountExists, _ := h.accounts.EmailExists(request.Email)
accountExists, _, _ := h.accounts.EmailExists(request.Email)
if accountExists {
errored(errEmailAlreadyExists)
return
}
pubkeyExists, _ := h.accounts.PubkeyExists(hex.EncodeToString(decodedKey[1:]))
pubkeyExists, _, _ := h.accounts.PubkeyExists(hex.EncodeToString(decodedKey[1:]))
if pubkeyExists {
errored(errPubkeyAlreadyExists)
@ -490,7 +490,7 @@ func (h *HttpHandler) accountLoginChallenge(jc jape.Context) {
return
}
pubkeyExists, _ := h.accounts.PubkeyExists(hex.EncodeToString(decodedKey[1:]))
pubkeyExists, _, _ := h.accounts.PubkeyExists(hex.EncodeToString(decodedKey[1:]))
if pubkeyExists {
errored(errPubkeyNotExist)
@ -603,7 +603,7 @@ func (h *HttpHandler) accountLogin(jc jape.Context) {
}
func (h *HttpHandler) accountInfo(jc jape.Context) {
_, user := h.accounts.AccountExists(jc.Request.Context().Value(middleware.S5AuthUserIDKey).(uint64))
_, user, _ := h.accounts.AccountExists(jc.Request.Context().Value(middleware.S5AuthUserIDKey).(uint))
info := &AccountInfoResponse{
Email: user.Email,
@ -623,7 +623,7 @@ func (h *HttpHandler) accountInfo(jc jape.Context) {
}
func (h *HttpHandler) accountStats(jc jape.Context) {
_, user := h.accounts.AccountExists(jc.Request.Context().Value(middleware.S5AuthUserIDKey).(uint64))
_, user, _ := h.accounts.AccountExists(jc.Request.Context().Value(middleware.S5AuthUserIDKey).(uint))
info := &AccountStatsResponse{
AccountInfoResponse: AccountInfoResponse{