mirror of
https://gitea.com/gitea/tea.git
synced 2025-09-02 01:48:30 +02:00
Improve tea logout
(#213)
fix message fix lint Impruve logout Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/213 Reviewed-by: Norwin <noerw@noreply.gitea.io> Reviewed-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
@ -184,6 +184,24 @@ func AddLogin(name, token, user, passwd, sshKey, giteaURL string, insecure bool)
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeleteLogin delete a login by name
|
||||
func DeleteLogin(name string) error {
|
||||
var idx = -1
|
||||
for i, l := range Config.Logins {
|
||||
if l.Name == name {
|
||||
idx = i
|
||||
break
|
||||
}
|
||||
}
|
||||
if idx == -1 {
|
||||
return fmt.Errorf("can not delete login '%s', does not exist", name)
|
||||
}
|
||||
|
||||
Config.Logins = append(Config.Logins[:idx], Config.Logins[idx+1:]...)
|
||||
|
||||
return SaveConfig()
|
||||
}
|
||||
|
||||
// GenerateLoginName generates a name string based on instance URL & adds username if the result is not unique
|
||||
func GenerateLoginName(url, user string) (string, error) {
|
||||
parsedURL, err := utils.NormalizeURL(url)
|
||||
|
Reference in New Issue
Block a user