Ejemplo n.º 1
0
def recover_new_password(uuid):
    verify = EmailVerification.by_hash(uuid)
    if not verify or not (verify.is_import or verify.is_recover):
        return NotFound()

    user = verify.user
    form = RecoverSetForm()
    if form.validate_on_submit():
        user.update_password(form.data['password'])
        db.session.delete(verify)
        db.session.commit()
        login_user(user)
        return redirect(url_for(".home"))

    return render_template("user/password_set.html", user=user, form=form, verify=verify)
Ejemplo n.º 2
0
def verify(uuid):
    verify = EmailVerification.by_hash(uuid)
    if not verify or not verify.is_verify:
        raise NotFound()

    user = verify.user
    user.verified = True
    db.session.delete(verify)
    db.session.commit()
    if not user.is_customer:
        send_mail(
            _("Activate user subject"),
            render_template("admin/user_activate_mail.txt", user=user, _external=True),
            [member.email for member in User.all_admins()]
        )

    flash(_("Email verified"), 'success')
    return redirect(url_for(".login"))
Ejemplo n.º 3
0
def recover_new_password(uuid):
    verify = EmailVerification.by_hash(uuid)
    if not verify or not (verify.is_import or verify.is_recover):
        return render_template("errors/404.html",
                               error_msg=_('infotext recover not possible'))

    user = verify.user
    form = RecoverSetForm()
    if form.validate_on_submit():
        user.update_password(form.data['password'])
        db.session.delete(verify)
        db.session.commit()
        login_user(user)
        return redirect(url_for(".home"))

    return render_template("user/password_set.html",
                           user=user,
                           form=form,
                           verify=verify)
Ejemplo n.º 4
0
def verify(uuid):
    verify = EmailVerification.by_hash(uuid)
    if not verify or not verify.is_verify:
        return render_template("errors/404.html",
                               error_msg=_('infotext verify not possible'))

    user = verify.user
    user.verified = True
    db.session.delete(verify)
    db.session.commit()

    send_mail(
        _("Activate user subject"),
        render_template("admin/user_activate_mail.txt",
                        user=user,
                        _external=True),
        [member.email for member in User.all_admins()])

    flash(_("Email verified"), 'success')
    return redirect(url_for(".login"))
Ejemplo n.º 5
0
def verify(uuid):
    verify = EmailVerification.by_hash(uuid)
    if not verify or not verify.is_verify:
        return render_template(
            "errors/404.html",
            error_msg=_('infotext verify not possible')
        )

    user = verify.user
    user.verified = True
    db.session.delete(verify)
    db.session.commit()

    send_mail(
        _("Activate user subject"),
        render_template("admin/user_activate_mail.txt", user=user, _external=True),
        [member.email for member in User.all_admins()]
    )

    flash(_("Email verified"), 'success')
    return redirect(url_for(".login"))