Class: Auther::BaseController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Auther::BaseController
- Defined in:
- app/controllers/auther/base_controller.rb
Overview
Abstract controller for session management.
Direct Known Subclasses
Instance Method Summary collapse
-
#create ⇒ Object
rubocop:disable Metrics/AbcSize.
-
#destroy ⇒ Object
rubocop:enable Metrics/AbcSize.
- #new ⇒ Object
- #show ⇒ Object
Instance Method Details
#create ⇒ Object
rubocop:disable Metrics/AbcSize
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/auther/base_controller.rb', line 15 def create @account = Auther::Presenter::Account.new(**account_params.to_h.symbolize_keys) account = Auther::Account[settings.find_account(@account.name)] authenticator = Auther::Authenticator.new settings.secret, account, @account if authenticator.authenticated? store_credentials account redirect_to (account) else remove_credentials account render template: new_template_path end end |
#destroy ⇒ Object
rubocop:enable Metrics/AbcSize
30 31 32 33 34 |
# File 'app/controllers/auther/base_controller.rb', line 30 def destroy account = Auther::Account[**settings.find_account(params[:name])] remove_credentials account redirect_to (account) end |
#new ⇒ Object
10 11 12 |
# File 'app/controllers/auther/base_controller.rb', line 10 def new @account = Auther::Presenter::Account.new end |
#show ⇒ Object
8 |
# File 'app/controllers/auther/base_controller.rb', line 8 def show = redirect_to settings.url |