Esempio n. 1
0
def register():
    if current_user.is_authenticated:
        return redirect(url_for('panel.panel'))
    form = RegistrationForm()
    if form.validate_on_submit():
        user = User(email=form.email.data, username=form.username.data)
        user.set_password(form.password.data)
        db.session.add(user)
        db.session.commit()
        flash("Account created", 'info')
        return redirect(url_for('auth.login'))
    return render_template('auth/register.html', form=form, title="Register")
Esempio n. 2
0
def adminpassword():
    """set admin password"""
    admin_username = "******"

    password = getpass.getpass()
    if len(password)<8:
        print "dame"
        return

    admin = User.query.get(1)

    if not admin:
        userrole = UserRole.query.get('admin')
        admin = User(admin_username, userrole)
        db_session.add(admin)
    
    admin.set_password(password)

    db_session.commit()
    db_session.remove()

    print "update successfully"
Esempio n. 3
0
def adminpassword():
    """set admin password"""
    admin_username = "******"

    password = getpass.getpass()
    if len(password) < 8:
        print "dame"
        return

    admin = User.query.get(1)

    if not admin:
        userrole = UserRole.query.get("admin")
        admin = User(admin_username, userrole)
        db_session.add(admin)

    admin.set_password(password)

    db_session.commit()
    db_session.remove()

    print "update successfully"