Exemplo n.º 1
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)
Exemplo n.º 2
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)
Exemplo n.º 3
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)
Exemplo n.º 4
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)