mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-29 15:12:45 +00:00
[bugfix] add in-use checks for admin cli account creation (#904)
This commit is contained in:
parent
832befd727
commit
5cd087241b
|
@ -46,6 +46,14 @@
|
||||||
return err
|
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()
|
email := config.GetAdminAccountEmail()
|
||||||
if email == "" {
|
if email == "" {
|
||||||
return errors.New("no email set")
|
return errors.New("no email set")
|
||||||
|
@ -54,6 +62,14 @@
|
||||||
return err
|
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()
|
password := config.GetAdminAccountPassword()
|
||||||
if password == "" {
|
if password == "" {
|
||||||
return errors.New("no password set")
|
return errors.New("no password set")
|
||||||
|
|
Loading…
Reference in a new issue