How to use the ramp-frontend.ramp_frontend.forms.EmailForm function in ramp-frontend

To help you get started, we’ve selected a few ramp-frontend examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github paris-saclay-cds / ramp-board / ramp-frontend / ramp_frontend / views / auth.py View on Github external
def reset_password():
    """Reset password of a RAMP user."""
    form = EmailForm()
    error = ''
    if form.validate_on_submit():
        user = User.query.filter_by(email=form.email.data).one_or_none()
        if user and user.access_level != 'asked':
            token = ts.dumps(user.email)
            recover_url = url_for(
                'auth.reset_with_token', token=token, _external=True
            )

            subject = "Password reset requested - RAMP website"
            body = ('Hi {}, \n\nclick on the link to reset your password:\n'
                    .format(user.firstname))
            body += recover_url
            body += '\n\nSee you on the RAMP website!'
            send_mail(user.email, subject, body)
            logger.info(