mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-19 00:36:38 +00:00
simplify authentication
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user