<commit_before>from ..forms.login import RecoveryForm, login_check
from saylua.utils.email import send_email

from flask import render_template, request, flash


def recover_login():
    form = RecoveryForm(request.form)
    if request.method == 'POST' and form.validate():
        user = login_check.user
        code = user.make_password_reset_code()

        send_email(user.email, 'Saylua Password Reset',
            'Your password reset link is: ' + code.url())

        flash('Recovery email sent! Check the email address on file for the next step.')

    return render_template('login/recover.html', form=form)


def reset_password(user, code):
    return render_template('login/recover.html')<commit_msg>Add devserver handling for password resets.<commit_after>from ..forms.login import RecoveryForm, login_check

from saylua.utils import is_devserver
from saylua.utils.email import send_email

from flask import render_template, request, flash


def recover_login():
    form = RecoveryForm(request.form)
    if request.method == 'POST' and form.validate():
        user = login_check.user
        code = user.make_password_reset_code()

        if is_devserver():
            flash('DEBUG MODE: Your reset code is %s' % code.url())
        else:
            send_email(user.email, 'Saylua Password Reset',
                'Your password reset link is: ' + code.url())
            flash('Recovery email sent! Check the email address on file for the next step.')

    return render_template('login/recover.html', form=form)


def reset_password(user, code):
    return render_template('login/recover.html')
{'fraction_non_alphanumeric': 0.0978328173374613, 'fraction_numerical': 0.0, 'mean_word_length': 3.4517906336088156, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6524315', 'n_tokens_mistral': 462, 'n_tokens_neox': 441, 'n_words': 137}