diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2021-03-25 02:46:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-25 02:46:13 +0100 |
commit | dd1eb9918ad54fec3a524a53e339ee6c8be9de11 (patch) | |
tree | f3b01f774ec790fa21c3d637bb61f820767aac0a | |
parent | f8e50eaea351d743bf80e65c2178c4ed46d65881 (diff) |
Add `email` param to `POST /api/v1/emails/confirmations` (#15949)
Allow changing e-mail as long as the account is unconfirmed
-rw-r--r-- | app/controllers/api/v1/emails/confirmations_controller.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/api/v1/emails/confirmations_controller.rb b/app/controllers/api/v1/emails/confirmations_controller.rb index 03ab5de8c..4a7aa9c32 100644 --- a/app/controllers/api/v1/emails/confirmations_controller.rb +++ b/app/controllers/api/v1/emails/confirmations_controller.rb @@ -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 |