mirror of
https://gitea.com/gitea/tea.git
synced 2026-02-22 06:13:32 +01:00
Revert "Login requires a http/https login URL and revmoe SSH as a login method. SSH will be optional (#826)" (#891)
This reverts commit 90f8624ae7.
Fixes: #890
---------
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/tea/pulls/891
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Michal Suchanek <msuchanek@suse.de>
Co-committed-by: Michal Suchanek <msuchanek@suse.de>
This commit is contained in:
committed by
Lunny Xiao
parent
3595f8f89d
commit
e644cc49d4
@@ -14,21 +14,25 @@ func ValidateAuthenticationMethod(
|
||||
token string,
|
||||
user string,
|
||||
passwd string,
|
||||
sshAgent bool,
|
||||
sshKey string,
|
||||
sshCertPrincipal string,
|
||||
) (*url.URL, error) {
|
||||
// Normalize URL
|
||||
serverURL, err := NormalizeURL(giteaURL)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to parse URL: %s", err)
|
||||
return nil, fmt.Errorf("Unable to parse URL: %s", err)
|
||||
}
|
||||
|
||||
// .. if we have enough information to authenticate
|
||||
if len(token) == 0 && (len(user)+len(passwd)) == 0 {
|
||||
return nil, fmt.Errorf("no token set")
|
||||
} else if len(user) != 0 && len(passwd) == 0 {
|
||||
return nil, fmt.Errorf("no password set")
|
||||
} else if len(user) == 0 && len(passwd) != 0 {
|
||||
return nil, fmt.Errorf("no user set")
|
||||
if !sshAgent && sshCertPrincipal == "" && sshKey == "" {
|
||||
// .. if we have enough information to authenticate
|
||||
if len(token) == 0 && (len(user)+len(passwd)) == 0 {
|
||||
return nil, fmt.Errorf("No token set")
|
||||
} else if len(user) != 0 && len(passwd) == 0 {
|
||||
return nil, fmt.Errorf("No password set")
|
||||
} else if len(user) == 0 && len(passwd) != 0 {
|
||||
return nil, fmt.Errorf("No user set")
|
||||
}
|
||||
}
|
||||
|
||||
return serverURL, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user