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

@@ -25,7 +25,7 @@ func (Link) Type() Method {
return MethodLink
}
func (l Link) Authenticate(r *http.Request) (string, bool, any) {
func (l Link) Authenticate(r *http.Request) (string, string) {
email := r.FormValue(linkFormId)
res, err := l.client.Authenticate(r.Context(), &proto.AuthenticateRequest{
@@ -40,15 +40,15 @@ func (l Link) Authenticate(r *http.Request) (string, bool, any) {
})
if err != nil {
// TODO: log error here
return "", false, linkFormId
return "", linkFormId
}
if res.GetSuccess() {
// Use the email address as the user identifier.
return email, true, nil
return email, ""
}
return "", false, linkFormId
return "", linkFormId
}
func (l Link) Middleware(next http.Handler) http.Handler {