You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
522 B
19 lines
522 B
|
2 months ago
|
package api
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
"net/http"
|
||
|
|
)
|
||
|
|
|
||
|
|
func (r *Router) verifyCurrentPassword(w http.ResponseWriter, ctx context.Context, password string) bool {
|
||
|
|
if password == "" {
|
||
|
|
writeError(w, http.StatusBadRequest, "password_required", "enter the current account password")
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
if err := r.store.VerifyCurrentPassword(ctx, password); err != nil {
|
||
|
|
writeError(w, http.StatusForbidden, "reauthentication_failed", "current account password is incorrect or account is locked")
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
return true
|
||
|
|
}
|