Browse Source

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

tags/20180716
Sam Black 2 years ago
parent
commit
4bbf8cd567
2 changed files with 12 additions and 7 deletions
  1. +9
    -4
      run.py
  2. +3
    -3
      vowel/utils/user.py

+ 9
- 4
run.py View File

@@ -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)



+ 3
- 3
vowel/utils/user.py View File

@@ -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