Sha256: 11bac4b10e0699372bbf21e37c6d001af149697ee5ea18e2660a8481bdfb4b1d

Contents?: true

Size: 717 Bytes

Versions: 13

Compression:

Stored size: 717 Bytes

Contents

class Identity::EmailsController < ApplicationController
  <%- if options.sudoable? -%>
  before_action :require_sudo
  <%- end -%>
  before_action :set_user

  def update
    if @user.update(user_params)
      render_show
    else
      render json: @user.errors, status: :unprocessable_entity
    end
  end

  private
    def set_user
      @user = Current.user
    end

    def user_params
      params.permit(:email)
    end

    def render_show
      if @user.email_previously_changed?
        resend_email_verification; render(json: @user)
      else
        render json: @user
      end
    end

    def resend_email_verification
      UserMailer.with(user: @user).email_verification.deliver_later
    end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
authentication-zero-2.16.5 lib/generators/authentication/templates/controllers/api/identity/emails_controller.rb.tt
authentication-zero-2.16.4 lib/generators/authentication/templates/controllers/api/identity/emails_controller.rb.tt
authentication-zero-2.16.3 lib/generators/authentication/templates/controllers/api/identity/emails_controller.rb.tt
authentication-zero-2.16.2 lib/generators/authentication/templates/controllers/api/identity/emails_controller.rb.tt
authentication-zero-2.16.1 lib/generators/authentication/templates/controllers/api/identity/emails_controller.rb.tt
authentication-zero-2.16.0 lib/generators/authentication/templates/controllers/api/identity/emails_controller.rb.tt
authentication-zero-2.15.9 lib/generators/authentication/templates/controllers/api/identity/emails_controller.rb.tt
authentication-zero-2.15.8 lib/generators/authentication/templates/controllers/api/identity/emails_controller.rb.tt
authentication-zero-2.15.7 lib/generators/authentication/templates/controllers/api/identity/emails_controller.rb.tt
authentication-zero-2.15.6 lib/generators/authentication/templates/controllers/api/identity/emails_controller.rb.tt
authentication-zero-2.15.5 lib/generators/authentication/templates/controllers/api/identity/emails_controller.rb.tt
authentication-zero-2.15.4 lib/generators/authentication/templates/controllers/api/identity/emails_controller.rb.tt
authentication-zero-2.15.3 lib/generators/authentication/templates/controllers/api/identity/emails_controller.rb.tt