Browse Source

Add `email` param to `POST /api/v1/emails/confirmations` (#15949)

Allow changing e-mail as long as the account is unconfirmed
closed-social-v3
Eugen Rochko 3 years ago
committed by GitHub
parent
commit
dd1eb9918a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      app/controllers/api/v1/emails/confirmations_controller.rb

+ 5
- 1
app/controllers/api/v1/emails/confirmations_controller.rb View File

@ -5,7 +5,11 @@ class Api::V1::Emails::ConfirmationsController < Api::BaseController
before_action :require_user_owned_by_application!
def create
current_user.resend_confirmation_instructions if current_user.unconfirmed_email.present?
if !current_user.confirmed? && current_user.unconfirmed_email.present?
current_user.update!(email: params[:email]) if params.key?(:email)
current_user.resend_confirmation_instructions
end
render_empty
end

Loading…
Cancel
Save