simplify authentication

This commit is contained in:
Alisdair MacLeod
2026-01-30 14:08:52 +00:00
parent e95cfa1a00
commit f882c36e0a
6 changed files with 38 additions and 40 deletions

View File

@@ -33,7 +33,7 @@ func (Password) Type() Method {
// If authentication fails, the required HTTP form ID is returned
// so that it can be injected into a request from the UI so that
// authentication may be successful.
func (p Password) Authenticate(r *http.Request) (string, bool, any) {
func (p Password) Authenticate(r *http.Request) (string, string) {
password := r.FormValue(passwordFormId)
res, err := p.client.Authenticate(r.Context(), &proto.AuthenticateRequest{
@@ -47,14 +47,14 @@ func (p Password) Authenticate(r *http.Request) (string, bool, any) {
})
if err != nil {
// TODO: log error here
return "", false, passwordFormId
return "", passwordFormId
}
if res.GetSuccess() {
return passwordUserId, true, nil
return passwordUserId, ""
}
return "", false, passwordFormId
return "", passwordFormId
}
func (p Password) Middleware(next http.Handler) http.Handler {