Skip to content

Commit

Permalink
Add email param to POST /api/v1/emails/confirmations (mastodon#15949
Browse files Browse the repository at this point in the history
)

Allow changing e-mail as long as the account is unconfirmed
  • Loading branch information
Gargron authored and chrisguida committed Feb 26, 2022
1 parent 51a111c commit b5884f1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/controllers/api/v1/emails/confirmations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit b5884f1

Please sign in to comment.