diff --git a/cmd/gotosocial/action/admin/account/account.go b/cmd/gotosocial/action/admin/account/account.go index 422e4bfef..17a27c199 100644 --- a/cmd/gotosocial/action/admin/account/account.go +++ b/cmd/gotosocial/action/admin/account/account.go @@ -46,6 +46,14 @@ return err } + usernameAvailable, err := dbConn.IsUsernameAvailable(ctx, username) + if err != nil { + return err + } + if !usernameAvailable { + return fmt.Errorf("username %s is already in use", username) + } + email := config.GetAdminAccountEmail() if email == "" { return errors.New("no email set") @@ -54,6 +62,14 @@ return err } + emailAvailable, err := dbConn.IsEmailAvailable(ctx, email) + if err != nil { + return err + } + if !emailAvailable { + return fmt.Errorf("email address %s is already in use", email) + } + password := config.GetAdminAccountPassword() if password == "" { return errors.New("no password set")