コード例 #1
0
def adduser():
    """ Build the view used to add new accounts """
    form = RegisterForm()

    if form.validate_on_submit():
        try:
            user = Users(username=form.username.data,
                         email=form.email.data,
                         specialties=form.specialties.data.split(','),
                         interests=form.interests.data.split(','))
            user.password = form.password.data
            user.save()
            token = user.generate_confirmation_token()
            send_email(user.email,
                       'Confirmare email',
                       'users/email/confirm',
                       user=user,
                       token=token)
            flash('Contul a fost adaugat!', category='alert-success')
        except Exception as err:
            flash('Utilizatorul are deja cont!', category='alert-warning')
        return redirect(url_for('users.list'))

    return render_template('users/add.html',
                           pagetitle='Adauga utilizator',
                           form=form)
コード例 #2
0
def registeruser():
    """ Build the view used to add new accounts """
    form = RegisterForm()

    if form.validate_on_submit():
        try:
            user = Users(username=form.username.data,
                         email=form.email.data,
                         specialties=form.specialties.data.split(','),
                         interests=form.interests.data.split(','))
            user.password = form.password.data
            user.save()
            token = user.generate_confirmation_token()
            send_email(user.email,
                       'Confirmare email',
                       'users/email/confirm',
                       user=user,
                       token=token)
            flash(
                'Contul a fost adaugat! Va rugam confirmati adresa de email!',
                category='alert-success')
        except Exception as err:
            flash('Contul nu poate fi creat!', category='alert-warning')
        return redirect(url_for('users.login'))

    return render_template('users/login.html',
                           pagetitle='Inregistrare',
                           form=form,
                           login=False)
コード例 #3
0
def create_admins(admin):

    from app.users.models import Users
    
    try:
        user = Users.objects(email=admin['email']).get()
    except:
        user = Users(email=admin['email'],username=admin['username'],permissions='full',status=True)
        user.password = admin['password']
        user.save()
コード例 #4
0
ファイル: views.py プロジェクト: HatchHackerspace/Intranet
def registeruser():
    """ Build the view used to add new accounts """
    form = RegisterForm()
    
    if form.validate_on_submit():
        try:
            user = Users(username=form.username.data,email=form.email.data,specialties=form.specialties.data.split(','),interests=form.interests.data.split(','))
            user.password = form.password.data
            user.save()
            token = user.generate_confirmation_token()
            send_email(user.email,'Confirmare email','users/email/confirm',user=user,token=token)
            flash('Contul a fost adaugat! Va rugam confirmati adresa de email!', category='alert-success')
        except Exception as err:
            flash('Contul nu poate fi creat!', category='alert-warning')
        return redirect(url_for('users.login'))
    
    return render_template('users/login.html',pagetitle='Inregistrare',form=form,login=False)
コード例 #5
0
ファイル: views.py プロジェクト: HatchHackerspace/Intranet
def adduser():
    """ Build the view used to add new accounts """
    form = RegisterForm()
    
    if form.validate_on_submit():
        try:
            user = Users(username=form.username.data,email=form.email.data,specialties=form.specialties.data.split(','),interests=form.interests.data.split(','))
            user.password = form.password.data
            user.save()
            token = user.generate_confirmation_token()
            send_email(user.email,'Confirmare email','users/email/confirm',user=user,token=token)
            flash('Contul a fost adaugat!', category='alert-success')
        except Exception as err:
            flash('Utilizatorul are deja cont!', category='alert-warning')
        return redirect(url_for('users.list'))
    
    return render_template('users/add.html',pagetitle='Adauga utilizator',form=form)