Sha256: 9a19305fd7098fdc0691562bc93df01e63e17cf13161886dac35601fb8139fea

Contents?: true

Size: 828 Bytes

Versions: 4

Compression:

Stored size: 828 Bytes

Contents

module LunarShell
  module Satellites
    class PasswdController < LunarShell::SatellitesController
      def run
        render 'no_user_error' unless current_user
      end

      def new_password
      end

      def confirm_password
      end

      def create
        @message = if user_auth && update_password!
          'Password updated.'
        else
          'try again'
        end
      end

      private

      def current_password
        passwd_params[:current_password]
      end

      def passwd_params
        params.
          require(:user).
          permit(:current_password, :password, :password_confirmation)
      end

      def update_password!
        current_user.update(passwd_params)
      end

      def user_auth
        current_user.authenticate(current_password)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lunar_shell-0.5.2 app/controllers/lunar_shell/satellites/passwd_controller.rb
lunar_shell-0.5.0 app/controllers/lunar_shell/satellites/passwd_controller.rb
lunar_shell-0.4.1 app/controllers/lunar_shell/satellites/passwd_controller.rb
lunar_shell-0.3.0 app/controllers/lunar_shell/satellites/passwd_controller.rb