Class: Auther::BaseController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/auther/base_controller.rb

Overview

Abstract controller for session management.

Direct Known Subclasses

SessionController

Instance Method Summary collapse

Instance Method Details

#createObject

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(**.to_h.symbolize_keys)
   = Auther::Account[settings.(@account.name)]
  authenticator = Auther::Authenticator.new settings.secret, , @account

  if authenticator.authenticated?
    store_credentials 
    redirect_to authorized_url()
  else
    remove_credentials 
    render template: new_template_path
  end
end

#destroyObject

rubocop:enable Metrics/AbcSize



30
31
32
33
34
# File 'app/controllers/auther/base_controller.rb', line 30

def destroy
   = Auther::Account[**settings.(params[:name])]
  remove_credentials 
  redirect_to deauthorized_url()
end

#newObject



10
11
12
# File 'app/controllers/auther/base_controller.rb', line 10

def new
  @account = Auther::Presenter::Account.new
end

#showObject



8
# File 'app/controllers/auther/base_controller.rb', line 8

def show = redirect_to settings.url