Sha256: 1e64e341089f936c8b7712ec022239d366391ad16088ebb682d401438a395501

Contents?: true

Size: 875 Bytes

Versions: 13

Compression:

Stored size: 875 Bytes

Contents

require_dependency "egov_utils/application_controller"

module EgovUtils
  class PasswordsController < ApplicationController

    skip_before_action :check_password_change

    def edit
      @user = current_user
    end

    def update
      @user = current_user
      if @user.password_change_possible? && @user.password_check?(params[:password_change][:current_password])
        @user.attributes = password_change_params
        @user.must_change_password = false
      end
      if @user.save
        flash[:notice] = t(:notice_password_changed)
        redirect_to main_app.root_path
      else
        flash[:warning] = t(:warning_password_not_changed)
        redirect_to edit_password_path(@user)
      end
    end

    private

      def password_change_params
        params.require(:password_change).permit(:password, :password_confirmation)
      end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
egov_utils-0.2.12 app/controllers/egov_utils/passwords_controller.rb
egov_utils-0.2.11 app/controllers/egov_utils/passwords_controller.rb
egov_utils-0.2.10 app/controllers/egov_utils/passwords_controller.rb
egov_utils-0.2.9 app/controllers/egov_utils/passwords_controller.rb
egov_utils-0.2.8 app/controllers/egov_utils/passwords_controller.rb
egov_utils-0.2.7 app/controllers/egov_utils/passwords_controller.rb
egov_utils-0.2.6 app/controllers/egov_utils/passwords_controller.rb
egov_utils-0.2.5 app/controllers/egov_utils/passwords_controller.rb
egov_utils-0.2.4 app/controllers/egov_utils/passwords_controller.rb
egov_utils-0.2.3 app/controllers/egov_utils/passwords_controller.rb
egov_utils-0.2.2 app/controllers/egov_utils/passwords_controller.rb
egov_utils-0.2.1 app/controllers/egov_utils/passwords_controller.rb
egov_utils-0.2.0 app/controllers/egov_utils/passwords_controller.rb