From b8b0a6c9cb43d52aece4020163b612cfe87de898 Mon Sep 17 00:00:00 2001 From: Jeff Halter <868228+jhalter@users.noreply.github.com> Date: Sat, 8 Jun 2024 10:54:16 -0700 Subject: Add support for account login rename --- hotline/server.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'hotline/server.go') 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) } -- cgit