diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2024-06-08 10:54:16 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2024-06-08 10:54:51 -0700 |
| commit | b8b0a6c9cb43d52aece4020163b612cfe87de898 (patch) | |
| tree | 991da47db3a976686a29f510b1421c33067fd911 /hotline/server.go | |
| parent | 5d87f76eeb76e4e67e5dabb2c835a640a7ab7652 (diff) | |
Add support for account login rename
Diffstat (limited to 'hotline/server.go')
| -rw-r--r-- | hotline/server.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/hotline/server.go b/hotline/server.go index a77e792..aca2221 100644 --- a/hotline/server.go +++ b/hotline/server.go @@ -447,11 +447,12 @@ func (s *Server) UpdateUser(login, newLogin, name, password string, access acces // update renames the user login if login != newLogin { - err := os.Rename(filepath.Join(s.ConfigDir, "Users", login+".yaml"), filepath.Join(s.ConfigDir, "Users", newLogin+".yaml")) + err := os.Rename(filepath.Join(s.ConfigDir, "Users", path.Join("/", login)+".yaml"), filepath.Join(s.ConfigDir, "Users", path.Join("/", newLogin)+".yaml")) if err != nil { - return err + return fmt.Errorf("unable to rename account: %w", err) } s.Accounts[newLogin] = s.Accounts[login] + s.Accounts[newLogin].Login = newLogin delete(s.Accounts, login) } |