Browse Source

Merge branch 'develop' of ssh://code.lapwing.org:22443/vowel/vowel into develop

develop
Sam Black 4 years ago
parent
commit
4bbf8cd567
  1. 13
      run.py
  2. 6
      vowel/utils/user.py

13
run.py

@ -116,8 +116,11 @@ def create_user():
else:
email = email_tmp
password = click.prompt("Password", hide_input=True,
confirmation_prompt=True)
password = None
while not password:
password = click.prompt("Password", hide_input=True,
confirmation_prompt=True)
admin = click.confirm("Administrator?")
roles = ("Admin",) if admin else ()
@ -146,8 +149,10 @@ def first_run():
else:
email = email_tmp
password = click.prompt("Administrator password", hide_input=True,
confirmation_prompt=True)
password = None
while not password:
password = click.prompt("Administrator Password",
hide_input=True, confirmation_prompt=True)
add_user(email, password, ("Admin",), True)

6
vowel/utils/user.py

@ -20,7 +20,7 @@ import arrow
from functools import wraps
from flask_security import current_user
from flask_security.utils import encrypt_password
from flask_security.utils import hash_password
from sqlalchemy import exc
from wtforms.validators import Email
from wtforms.validators import ValidationError
@ -105,12 +105,12 @@ def add_user(email, password, roles, admin_first_run=False):
fullname = email.split("@")[0]
if admin_first_run:
user_datastore.create_user(email=email,
password=encrypt_password(password),
password=hash_password(password),
fullname=fullname,
confirmed_at=arrow.utcnow())
else:
user_datastore.create_user(email=email,
password=encrypt_password(password),
password=hash_password(password),
fullname=fullname)
try:

Loading…
Cancel
Save