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
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/auther/base_controller.rb', line 17 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
32 33 34 35 36 |
# File 'app/controllers/auther/base_controller.rb', line 32 def destroy account = Auther::Account[**settings.find_account(params[:name])] remove_credentials account redirect_to (account) end |
#new ⇒ Object
12 13 14 |
# File 'app/controllers/auther/base_controller.rb', line 12 def new @account = Auther::Presenter::Account.new end |
#show ⇒ Object
8 9 10 |
# File 'app/controllers/auther/base_controller.rb', line 8 def show redirect_to settings.url end |