From 0d3a68997a830f09f050e4195ab1c9673d422878 Mon Sep 17 00:00:00 2001 From: Urko Date: Wed, 9 Aug 2023 20:07:49 +0200 Subject: [PATCH] fix: get user account --- internal/services/prosody/account.go | 5 ++++- internal/services/prosody/change_password.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/services/prosody/account.go b/internal/services/prosody/account.go index 77993b8..29bc15c 100644 --- a/internal/services/prosody/account.go +++ b/internal/services/prosody/account.go @@ -7,6 +7,7 @@ import ( ) type account struct { + User string Salt string `prosody:"salt"` StoredKey string `prosody:"stored_key"` IterationCount string `prosody:"iteration_count"` @@ -47,7 +48,9 @@ func (p *Prosody) loadAccount(username string) (*account, error) { } } - acc := &account{} + acc := &account{ + User: username, + } acc.unmarshal(mapValues) return acc, nil } diff --git a/internal/services/prosody/change_password.go b/internal/services/prosody/change_password.go index 6d989b4..0934506 100644 --- a/internal/services/prosody/change_password.go +++ b/internal/services/prosody/change_password.go @@ -33,7 +33,7 @@ func (p *Prosody) ChangePassword(user string, currentPwd string, newPwd string) return errors.New("password is incorrect") } - cmd := exec.Command("/usr/bin/prosodyctl", "passwd", user+"@"+p.plainDomain) + cmd := exec.Command("/usr/bin/prosodyctl", "passwd", acc.User+"@"+p.plainDomain) // Create a pipe to write to the process's standard input. stdin, err := cmd.StdinPipe() if err != nil {