Ejemplo n.º 1
0
def profile_edit():
    form = EditProfileForm(obj=current_user)
    if form.validate_on_submit():
        if User.if_exists_email(form.email._value()) and current_user.email!=form.email._value():
            flash(gettext("An account has already been registered with that email. Try another?"), 'warning')
            return render_template('profile-edit.html', form=form, user=current_user)
        if not current_user.username == form.username._value():
            flash(gettext("You little rebel! I like you!"), 'warning')
            return render_template('profile-edit.html', form=form, user=current_user)
        form.populate_obj(current_user)
        current_user.commit()
        flash(gettext('User {username} edited').format(username=current_user.username),'success')
    return render_template('profile-edit.html', form=form, user=current_user)
Ejemplo n.º 2
0
def profile_edit():
    form = EditProfileForm(obj=current_user)
    if form.validate_on_submit():
        if User.if_exists_email(form.email._value(
        )) and current_user.email != form.email._value():
            flash(
                gettext(
                    "An account has already been registered with that email. Try another?"
                ), 'warning')
            return render_template('profile-edit.html',
                                   form=form,
                                   user=current_user)
        if not current_user.username == form.username._value():
            flash(gettext("You little rebel! I like you!"), 'warning')
            return render_template('profile-edit.html',
                                   form=form,
                                   user=current_user)
        form.populate_obj(current_user)
        current_user.commit()
        flash(
            gettext('User {username} edited').format(
                username=current_user.username), 'success')
    return render_template('profile-edit.html', form=form, user=current_user)
Ejemplo n.º 3
0
def email_is_available(email):
    if not User.if_exists_email(email):
        return True
    return False
Ejemplo n.º 4
0
def email_is_available(email):
    if not User.if_exists_email(email):
        return True
    return False