def install(welcome, force, username, email, password): """Installs flaskbb. If no arguments are used, an interactive setup will be run. """ click.secho("[+] Installing FlaskBB...", fg="cyan") if database_exists(db.engine.url): if force or click.confirm( click.style( "Existing database found. Do you want to delete the old one and " "create a new one?", fg="magenta")): db.drop_all() else: sys.exit(0) # creating database from scratch and 'stamping it' create_latest_db() click.secho("[+] Creating default settings...", fg="cyan") create_default_groups() create_default_settings() click.secho("[+] Creating admin user...", fg="cyan") prompt_save_user(username, email, password, "admin") if welcome: click.secho("[+] Creating welcome forum...", fg="cyan") create_welcome_forum() click.secho("[+] Compiling translations...", fg="cyan") compile_translations() click.secho("[+] FlaskBB has been successfully installed!", fg="green", bold=True)
def install(welcome, force, username, email, password, group): """Installs flaskbb. If no arguments are used, an interactive setup will be run. """ click.secho("[+] Installing FlaskBB...", fg="cyan") if database_exists(db.engine.url): if force or click.confirm(click.style( "Existing database found. Do you want to delete the old one and " "create a new one?", fg="magenta") ): drop_database(db.engine.url) else: sys.exit(0) create_database(db.engine.url) upgrade_database() click.secho("[+] Creating default settings...", fg="cyan") create_default_groups() create_default_settings() click.secho("[+] Creating admin user...", fg="cyan") prompt_save_user(username, email, password, group) if welcome: click.secho("[+] Creating welcome forum...", fg="cyan") create_welcome_forum() click.secho("[+] Compiling translations...", fg="cyan") compile_translations() click.secho("[+] FlaskBB has been successfully installed!", fg="green", bold=True)
def install(welcome, force, username, email, password, no_plugins): """Installs flaskbb. If no arguments are used, an interactive setup will be run. """ if not current_app.config["CONFIG_PATH"]: click.secho( "[!] No 'flaskbb.cfg' config found. " "You can generate a configuration file with 'flaskbb makeconfig'.", fg="red", ) sys.exit(1) click.secho("[+] Installing FlaskBB...", fg="cyan") if database_exists(db.engine.url): if force or click.confirm( click.style( "Existing database found. Do you want to delete the old one and " "create a new one?", fg="magenta", )): db.drop_all() else: sys.exit(0) # creating database from scratch and 'stamping it' create_latest_db() click.secho("[+] Creating default settings...", fg="cyan") create_default_groups() create_default_settings() click.secho("[+] Creating admin user...", fg="cyan") prompt_save_user(username, email, password, "admin") if welcome: click.secho("[+] Creating welcome forum...", fg="cyan") create_welcome_forum() if not no_plugins: click.secho("[+] Installing default plugins...", fg="cyan") run_plugin_migrations() click.secho("[+] Compiling translations...", fg="cyan") compile_translations() click.secho("[+] FlaskBB has been successfully installed!", fg="green", bold=True)
def change_user(username, email, password, group): """Updates an user. Omit any options to use the interactive mode.""" user = prompt_save_user(username, email, password, group, only_update=True) if user is None: raise FlaskBBCLIError("The user with username {} does not exist." .format(username), fg="red") click.secho("[+] User {} updated.".format(user.username), fg="cyan")
def new_user(username, email, password, group): """Creates a new user. Omit any options to use the interactive mode.""" try: user = prompt_save_user(username, email, password, group) click.secho("[+] User {} with Email {} in Group {} created.".format( user.username, user.email, user.primary_group.name), fg="cyan" ) except IntegrityError: raise FlaskBBCLIError("Couldn't create the user because the " "username or email address is already taken.", fg="red")