@collect_auth
def resend_confirmation_post(auth):
 if auth.logged_in:
  return auth_logout(redirect_url=request.url)
 form = ResendConfirmationForm(request.form)
 if form.validate():
  clean_email = form.email.data
  user = get_user(email=clean_email)
  status_message = 'If there is an OSF account associated with this unconfirmed email {0}, a confirmation email has been resent to it. If you do not receive an email and believe you should have, please contact OSF Support.'.format(clean_email)
  kind = 'success'
  if user:
   if throttle_period_expired(user.email_last_sent, settings.SEND_EMAIL_THROTTLE):
    try:
     send_confirm_email(user, clean_email, renew=True)
    except KeyError:
     status_message = 'This email {0} has already been confirmed.'.format(clean_email)
     kind = 'warning'
    user.email_last_sent = timezone.now()
    user.save()
   else:
    status_message = 'You have recently requested to resend your confirmation email. Please wait a few minutes before trying again.'
    kind = 'error'
  status.push_status_message(status_message, kind=kind, trust=False)
 else:
  forms.push_errors_to_status(form.errors)
 return {'form': form}

@ collect_auth def resend_confirmation_post ( auth ) : if auth . logged_in : return auth_logout ( redirect_url = request . url ) form = ResendConfirmationForm ( request . form ) if form . validate ( ) : clean_email = form . email . data user = get_user ( email = clean_email ) status_message = 'If there is an OSF account associated with this unconfirmed email {0}, a confirmation email has been resent to it. If you do not receive an email and believe you should have, please contact OSF Support.' . format ( clean_email ) kind = 'success' if user : if throttle_period_expired ( user . email_last_sent , settings . SEND_EMAIL_THROTTLE ) : try : send_confirm_email ( user , clean_email , renew = True ) except KeyError : status_message = 'This email {0} has already been confirmed.' . format ( clean_email ) kind = 'warning' user . email_last_sent = timezone . now ( ) user . save ( ) else : status_message = 'You have recently requested to resend your confirmation email. Please wait a few minutes before trying again.' kind = 'error' status . push_status_message ( status_message , kind = kind , trust = False ) else : forms . push_errors_to_status ( form . errors ) return { 'form' : form }
view for user to submit resend confirmation form .