aboutsummaryrefslogtreecommitdiff
path: root/cmd/create-account
diff options
context:
space:
mode:
authorS7evinK <tfaelligen@gmail.com>2020-06-01 19:34:29 +0200
committerGitHub <noreply@github.com>2020-06-01 18:34:29 +0100
commit895c8f03c031a613f8f603eba753056ae4eb83b9 (patch)
treeb26e9445f62f2c53e11531a88e8b45c4439034dd /cmd/create-account
parentcfc137652ed0d783d946836cf4e9e18267a438dc (diff)
Fix pg user already exists (#1076)
* Return newly created error if user already exists (#1002) Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Rename variable * Remove check for account and use returned error * Return ErrUserExists Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * State that CreateAccount will return err ErrUserExists if the user exists Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Also check sqlite for constraint error * Revert "Also check sqlite for constraint error" This reverts commit 7d310514 * Check for sqlite3 constraint error * Add documentation to CreateAccount * Move ErrUserExists to accounts package * Revert "Move ErrUserExists to accounts package" Import Cycle.. This reverts commit be3d4cda Co-authored-by: Kegsay <kegan@matrix.org>
Diffstat (limited to 'cmd/create-account')
-rw-r--r--cmd/create-account/main.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/cmd/create-account/main.go b/cmd/create-account/main.go
index eca9b2fe..9c1e4593 100644
--- a/cmd/create-account/main.go
+++ b/cmd/create-account/main.go
@@ -69,13 +69,10 @@ func main() {
os.Exit(1)
}
- account, err := accountDB.CreateAccount(context.Background(), *username, *password, "")
+ _, err = accountDB.CreateAccount(context.Background(), *username, *password, "")
if err != nil {
fmt.Println(err.Error())
os.Exit(1)
- } else if account == nil {
- fmt.Println("Username already exists")
- os.Exit(1)
}
deviceDB, err := devices.NewDatabase(*database, nil, serverName)