refactor: update usage of account methods
This commit is contained in:
parent
bbb68aecb5
commit
3e629cf46e
|
@ -405,14 +405,14 @@ func (h *HttpHandler) accountRegister(jc jape.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
accountExists, _ := h.accounts.EmailExists(request.Email)
|
accountExists, _, _ := h.accounts.EmailExists(request.Email)
|
||||||
|
|
||||||
if accountExists {
|
if accountExists {
|
||||||
errored(errEmailAlreadyExists)
|
errored(errEmailAlreadyExists)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
pubkeyExists, _ := h.accounts.PubkeyExists(hex.EncodeToString(decodedKey[1:]))
|
pubkeyExists, _, _ := h.accounts.PubkeyExists(hex.EncodeToString(decodedKey[1:]))
|
||||||
|
|
||||||
if pubkeyExists {
|
if pubkeyExists {
|
||||||
errored(errPubkeyAlreadyExists)
|
errored(errPubkeyAlreadyExists)
|
||||||
|
@ -490,7 +490,7 @@ func (h *HttpHandler) accountLoginChallenge(jc jape.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
pubkeyExists, _ := h.accounts.PubkeyExists(hex.EncodeToString(decodedKey[1:]))
|
pubkeyExists, _, _ := h.accounts.PubkeyExists(hex.EncodeToString(decodedKey[1:]))
|
||||||
|
|
||||||
if pubkeyExists {
|
if pubkeyExists {
|
||||||
errored(errPubkeyNotExist)
|
errored(errPubkeyNotExist)
|
||||||
|
@ -603,7 +603,7 @@ func (h *HttpHandler) accountLogin(jc jape.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *HttpHandler) accountInfo(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{
|
info := &AccountInfoResponse{
|
||||||
Email: user.Email,
|
Email: user.Email,
|
||||||
|
@ -623,7 +623,7 @@ func (h *HttpHandler) accountInfo(jc jape.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *HttpHandler) accountStats(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{
|
info := &AccountStatsResponse{
|
||||||
AccountInfoResponse: AccountInfoResponse{
|
AccountInfoResponse: AccountInfoResponse{
|
||||||
|
|
Loading…
Reference in New Issue