Class: Backend::MyselvesController

Inherits:
BaseController show all
Defined in:
app/controllers/backend/myselves_controller.rb

Instance Attribute Summary

Attributes inherited from ApplicationController

#current_theme

Instance Method Summary collapse

Methods inherited from BaseController

accounts_range_crit, crit_params, journal_entries_states_crit, journal_period_crit, journals_crit, search_conditions

Methods inherited from ApplicationController

#after_sign_in_path_for, #authorized?, human_action_name, #human_action_name

Instance Method Details

#change_passwordObject


37
38
39
40
41
42
43
44
45
46
# File 'app/controllers/backend/myselves_controller.rb', line 37

def change_password
  permitted_params = params.require(:user).permit(:current_password, :password, :password_confirmation)
  if @user.update_with_password(permitted_params)
    notify_success :update_is_done
     @user, bypass: true
    redirect_to action: :show
  else
    render 'show'
  end
end

#showObject


23
24
# File 'app/controllers/backend/myselves_controller.rb', line 23

def show
end

#updateObject


26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/backend/myselves_controller.rb', line 26

def update
  permitted_params = params.require(:user).permit(:first_name, :last_name, :language)
  if @user.update_attributes(permitted_params)
    I18n.locale = permitted_params[:language]
    notify_success :update_is_done
    redirect_to action: :show
  else
    render 'show'
  end
end