Exemple #1
0
def create_user():
    username = raw_input("Enter name:")
    email = raw_input("Enter email:")
    password = getpass("Enter password:"******"Enter password once more:")
    if password != password_repeat:
        print("Passwords not equivalent!")

    # user = create_user(name=username, email=email, password=password)
    user = user_data_store.create_user(name=username, email=email, password=encrypt_password(password))
    db.session.commit()
    if user:
        print("User successfully created")
Exemple #2
0
def create_user():
    username = raw_input("Enter name:")
    email = raw_input("Enter email:")
    password = getpass("Enter password:"******"Enter password once more:")
    if password != password_repeat:
        print("Passwords not equivalent!")

    # user = create_user(name=username, email=email, password=password)
    user = user_data_store.create_user(name=username,
                                       email=email,
                                       password=encrypt_password(password))
    db.session.commit()
    if user:
        print("User successfully created")
Exemple #3
0
def create_superuser():
    def get_superuser_role():
        role = Role.query.filter_by(name="superuser").first()
        if not role:
            role = Role(name="superuser", description="grants full access")
            db.session.add(role)
            db.session.commit()
        return role

    username = raw_input("Enter name:")
    email = raw_input("Enter email:")
    password = getpass("Enter password:"******"Enter password once more:")
    if password != password_repeat:
        print("Passwords not equivalent!")

    user = user_data_store.create_user(name=username, email=email, password=encrypt_password(password))
    user.roles.append(get_superuser_role())
    db.session.commit()
    if user:
        print("User successfully created")
Exemple #4
0
def create_superuser():
    def get_superuser_role():
        role = Role.query.filter_by(name="superuser").first()
        if not role:
            role = Role(name="superuser", description="grants full access")
            db.session.add(role)
            db.session.commit()
        return role

    username = raw_input("Enter name:")
    email = raw_input("Enter email:")
    password = getpass("Enter password:"******"Enter password once more:")
    if password != password_repeat:
        print("Passwords not equivalent!")

    user = user_data_store.create_user(name=username,
                                       email=email,
                                       password=encrypt_password(password))
    user.roles.append(get_superuser_role())
    db.session.commit()
    if user:
        print("User successfully created")