Просмотр исходного кода

Merge pull request #352 from djsilcock/patch-2

Always make CLI Install user an admin
Alec Nikolas Reiter 7 лет назад
Родитель
Сommit
3d97f64886
2 измененных файлов с 3 добавлено и 5 удалено
  1. 2 4
      flaskbb/cli/main.py
  2. 1 1
      flaskbb/cli/users.py

+ 2 - 4
flaskbb/cli/main.py

@@ -107,9 +107,7 @@ flaskbb.add_command(alembic_click, "db")
 @click.option("--email", "-e", type=EmailType(),
               help="The email address of the user.")
 @click.option("--password", "-p", help="The password of the user.")
-@click.option("--group", "-g", help="The group of the user.",
-              type=click.Choice(["admin", "super_mod", "mod", "member"]))
-def install(welcome, force, username, email, password, group):
+def install(welcome, force, username, email, password):
     """Installs flaskbb. If no arguments are used, an interactive setup
     will be run.
     """
@@ -130,7 +128,7 @@ def install(welcome, force, username, email, password, group):
     create_default_settings()
 
     click.secho("[+] Creating admin user...", fg="cyan")
-    prompt_save_user(username, email, password, group)
+    prompt_save_user(username, email, password, "admin")
 
     if welcome:
         click.secho("[+] Creating welcome forum...", fg="cyan")

+ 1 - 1
flaskbb/cli/users.py

@@ -56,7 +56,7 @@ def new_user(username, email, password, group):
 def change_user(username, password, email, group):
     """Updates an user. Omit any options to use the interactive mode."""
 
-    user = prompt_save_user(username, password, email, group)
+    user = prompt_save_user(username, password, email, group, only_update=True)
     if user is None:
         raise FlaskBBCLIError("The user with username {} does not exist."
                               .format(username), fg="red")