Class: Searls::Auth::SettingsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Searls::Auth::SettingsController
- Defined in:
- app/controllers/searls/auth/settings_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Instance Method Details
#edit ⇒ Object
10 11 12 |
# File 'app/controllers/searls/auth/settings_controller.rb', line 10 def edit render :edit, layout: Searls::Auth.config.layout end |
#update ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/searls/auth/settings_controller.rb', line 14 def update permitted_params = settings_params.to_h result = UpdatesSettings.new( user: settings_user, params: permitted_params ).update @settings_user = result.user @password_on_file = nil if result.success? flash[:notice] = Searls::Auth.config.resolve(:flash_notice_after_settings_update, settings_user, params) else # Normally, we would flash.now and render `settings_view`, but this controller is # intended to back forms hosted elsewhere. Redirecting keeps the host UI in control # while surfacing validation errors via the session flash. flash[:alert] = Array(result.errors).compact_blank.first end redirect_target = Searls::Auth.config.resolve( :redirect_path_after_settings_change, settings_user, params, request, searls_auth ) || searls_auth.edit_settings_path redirect_to redirect_target end |