Sha256: e43bc42a061d4eb60b99164c3f4ffaf5bd3fd139c7616dcbf2c941e1fce3519c

Contents?: true

Size: 738 Bytes

Versions: 10

Compression:

Stored size: 738 Bytes

Contents

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

  def edit
  end

  def update
    <%- unless options.sudoable? -%>
    if !@user.authenticate(params[:current_password])
      redirect_to edit_identity_email_path, alert: "The password you entered is incorrect"
    elsif @user.update(user_params)
    <%- else -%>
    if @user.update(user_params)
    <%- end -%>
      redirect_to root_path, notice: "Your email has been changed"
    else
      render :edit, status: :unprocessable_entity
    end
  end

  private
    def set_user
      @user = Current.user
    end

    def user_params
      params.permit(:email)
    end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
authentication-zero-2.15.0 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.14.0 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.13.0 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.12.6 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.12.5 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.12.4 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.12.3 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.12.2 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.12.1 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt
authentication-zero-2.12.0 lib/generators/authentication/templates/controllers/html/identity/emails_controller.rb.tt