Sha256: 61e2e2bc60bda828c0e52b96cac277ef0c1bb7c92f1a22291f031c998e06e3c0

Contents?: true

Size: 783 Bytes

Versions: 13

Compression:

Stored size: 783 Bytes

Contents

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

  def edit
  end

  def update
    if @user.update(user_params)
      redirect_to_root
    else
      render :edit, status: :unprocessable_entity
    end
  end

  private
    def set_user
      @user = Current.user
    end

    def user_params
      params.permit(:email)
    end

    def redirect_to_root
      if @user.email_previously_changed?
        resend_email_verification
        redirect_to root_path, notice: "Your email has been changed"
      else
        redirect_to root_path
      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/html/identity/emails_controller.rb.tt
authentication-zero-2.16.4 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.16.3 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.16.2 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.16.1 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.16.0 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.15.9 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.15.8 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.15.7 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.15.6 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.15.5 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.15.4 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.15.3 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt