zenodo_accessrequests/views/requests.py
def confirm(pid, record, template, **kwargs):
    """Confirm email address."""
    recid = int(pid.pid_value)

    token = request.view_args['token']

    # Validate token
    data = EmailConfirmationSerializer.compat_validate_token(token)
    if data is None:
        flash(_("Invalid confirmation link."), category='danger')
        return redirect(url_for("invenio_records_ui.recid", pid_value=recid))

    # Validate request exists.
    r = AccessRequest.query.get(data['id'])
    if not r:
        abort(404)

    # Confirm email address.
    if r.status != RequestStatus.EMAIL_VALIDATION:
        abort(404)

    r.confirm_email()
    db.session.commit()
    flash(_("Email validated and access request submitted."), category='info')

    return redirect(url_for("invenio_records_ui.recid", pid_value=recid))
def confirm(pid, record, template, **kwargs):
    """Confirm email address."""
    recid = int(pid.pid_value)

    token = request.view_args['token']

    # Validate token
    data = EmailConfirmationSerializer.compat_validate_token(token)
    if data is None:
        flash(_("Invalid confirmation link."), category='danger')
        return redirect(url_for("invenio_records_ui.recid", pid_value=recid))

    # Validate request exists.
    r = AccessRequest.query.get(data['id'])
    if not r:
        abort(404)

    # Confirm email address.
    if r.status != RequestStatus.EMAIL_VALIDATION:
        abort(404)

    r.confirm_email()
    db.session.commit()
    flash(_("Email validated and access request submitted."), category='info')

    return redirect(url_for("invenio_records_ui.recid", pid_value=recid))
Confirm email address.