def edit_user_email(service_id, user_id): user = current_service.get_team_member(user_id) user_email = user.email_address session_key = 'team_member_email_change-{}'.format(user_id) if is_gov_user(user_email): form = ChangeEmailForm(User.already_registered, email_address=user_email) else: form = ChangeNonGovEmailForm(User.already_registered, email_address=user_email) if request.form.get('email_address', '').strip() == user_email: return redirect(url_for('.manage_users', service_id=current_service.id)) if form.validate_on_submit(): session[session_key] = form.email_address.data return redirect( url_for('.confirm_edit_user_email', user_id=user.id, service_id=service_id)) return render_template('views/manage-users/edit-user-email.html', user=user, form=form, service_id=service_id)
def user_profile_email(): form = ChangeEmailForm(User.already_registered, email_address=current_user.email_address) if form.validate_on_submit(): session[NEW_EMAIL] = form.email_address.data return redirect(url_for('.user_profile_email_authenticate')) return render_template('views/user-profile/change.html', thing='email address', form_field=form.email_address)
def user_profile_email(): def _is_email_unique(email): return user_api_client.is_email_unique(email) form = ChangeEmailForm(_is_email_unique, email_address=current_user.email_address) if form.validate_on_submit(): session[NEW_EMAIL] = form.email_address.data return redirect(url_for('.user_profile_email_authenticate')) return render_template('views/user-profile/change.html', thing='email address', form_field=form.email_address)
def user_profile_email(): if not is_gov_user(current_user.email_address): abort(403) def _is_email_unique(email): return user_api_client.is_email_unique(email) form = ChangeEmailForm(_is_email_unique, email_address=current_user.email_address) if form.validate_on_submit(): session[NEW_EMAIL] = form.email_address.data return redirect(url_for('.user_profile_email_authenticate')) return render_template( 'views/user-profile/change.html', thing='email address', form_field=form.email_address )