Class: DeviseIosRails::ChangePasswordService

Inherits:
Object
  • Object
show all
Defined in:
app/services/devise_ios_rails/change_password_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(current_user, params) ⇒ ChangePasswordService

Returns a new instance of ChangePasswordService.



4
5
6
7
# File 'app/services/devise_ios_rails/change_password_service.rb', line 4

def initialize(current_user, params)
  @params = Hash(params)
  @current_user = current_user
end

Instance Attribute Details

#current_userObject (readonly)

Returns the value of attribute current_user.



3
4
5
# File 'app/services/devise_ios_rails/change_password_service.rb', line 3

def current_user
  @current_user
end

#paramsObject (readonly)

Returns the value of attribute params.



3
4
5
# File 'app/services/devise_ios_rails/change_password_service.rb', line 3

def params
  @params
end

Instance Method Details

#call!Object



9
10
11
12
13
14
15
# File 'app/services/devise_ios_rails/change_password_service.rb', line 9

def call!
  return if current_user.nil?
  current_user.password = snake_case_params[:password]
  current_user.password_confirmation = snake_case_params[:password_confirmation]
  current_user.save
  current_user
end