How to use the ramp-frontend.ramp_frontend.utils.body_formatter_user 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
)
        return redirect(url_for('auth.login'))
    elif user.access_level == 'asked':
        flash(
            "Your email address already has been confirmed. You need to wait "
            "for an approval from a RAMP administrator", category='error'
        )
        return redirect(url_for('general.index'))
    User.query.filter_by(email=email).update({'access_level': 'asked'})
    db.session.commit()
    admin_users = User.query.filter_by(access_level='admin')
    for admin in admin_users:
        subject = 'Approve registration of {}'.format(
            user.name
        )
        body = body_formatter_user(user)
        url_approve = ('http://{}/sign_up/{}'
                       .format(app.config['DOMAIN_NAME'], user.name))
        body += 'Click on the link to approve the registration '
        body += 'of this user: {}'.format(url_approve)
        send_mail(admin.email, subject, body)
    flash(
        "An email has been sent to the RAMP administrator(s) who will "
        "approve your account"
    )
    return redirect(url_for('auth.login'))
github paris-saclay-cds / ramp-board / ramp-frontend / ramp_frontend / views / ramp.py View on Github external
if not is_accessible_event(db.session, event_name,
                               flask_login.current_user.name):
        return redirect_to_user('{}: no event named "{}"'
                                .format(flask_login.current_user.firstname,
                                        event_name))
    if app.config['TRACK_USER_INTERACTION']:
        add_user_interaction(db.session, interaction='signing up at event',
                             user=flask_login.current_user, event=event)

    ask_sign_up_team(db.session, event.name, flask_login.current_user.name)
    if event.is_controled_signup:
        admin_users = User.query.filter_by(access_level='admin')
        for admin in admin_users:
            subject = ('Request to sign-up {} to RAMP event {}'
                       .format(event.name, flask_login.current_user.name))
            body = body_formatter_user(flask_login.current_user)
            url_approve = ('http://{}/events/{}/sign_up/{}'
                           .format(
                               app.config['DOMAIN_NAME'], event.name,
                               flask_login.current_user.name
                           ))
            body += ('Click on this link to approve the sign-up request: {}'
                     .format(url_approve))
            send_mail(admin.email, subject, body)
        return redirect_to_user("Sign-up request is sent to event admins.",
                                is_error=False, category='Request sent')
    sign_up_team(db.session, event.name, flask_login.current_user.name)
    return redirect_to_sandbox(
        event,
        '{} is signed up for {}.'
        .format(flask_login.current_user.firstname, event),
        is_error=False,