-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #914 from internetee/refactor-devise-integration
Refactor devise integration
- Loading branch information
Showing
99 changed files
with
712 additions
and
536 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
module Admin | ||
class BaseController < ApplicationController | ||
before_action :authenticate_user! | ||
before_action :authenticate_admin_user! | ||
helper_method :head_title_sufix | ||
|
||
def head_title_sufix | ||
t(:admin_head_title_sufix) | ||
end | ||
|
||
private | ||
|
||
def current_ability | ||
@current_ability ||= Ability.new(current_admin_user) | ||
end | ||
|
||
def user_for_paper_trail | ||
current_admin_user ? current_admin_user.id_role_username : 'anonymous' | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Admin | ||
class DashboardController < BaseController | ||
authorize_resource class: false | ||
|
||
def show; end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,17 @@ | ||
module Admin | ||
class SessionsController < Devise::SessionsController | ||
skip_authorization_check only: :create | ||
private | ||
|
||
def login | ||
@admin_user = AdminUser.new | ||
def after_sign_in_path_for(_resource_or_scope) | ||
admin_domains_path | ||
end | ||
|
||
def create | ||
if params[:admin_user].blank? | ||
@admin_user = AdminUser.new | ||
flash[:alert] = 'Something went wrong' | ||
return render 'login' | ||
end | ||
|
||
@admin_user = AdminUser.find_by(username: params[:admin_user][:username]) | ||
@admin_user ||= AdminUser.new(username: params[:admin_user][:username]) | ||
def after_sign_out_path_for(_resource_or_scope) | ||
new_admin_user_session_path | ||
end | ||
|
||
if @admin_user.valid_password?(params[:admin_user][:password]) | ||
sign_in @admin_user, event: :authentication | ||
redirect_to admin_root_url, notice: I18n.t(:welcome) | ||
else | ||
flash[:alert] = 'Authorization error' | ||
render 'login' | ||
end | ||
def user_for_paper_trail | ||
current_admin_user ? current_admin_user.id_role_username : 'anonymous' | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,22 @@ | ||
class RegistrantController < ApplicationController | ||
before_action :authenticate_user! | ||
before_action :authenticate_registrant_user! | ||
layout 'registrant/application' | ||
|
||
include Registrant::ApplicationHelper | ||
|
||
helper_method :head_title_sufix | ||
|
||
def head_title_sufix | ||
t(:registrant_head_title_sufix) | ||
end | ||
end | ||
|
||
private | ||
|
||
def current_ability | ||
@current_ability ||= Ability.new(current_registrant_user, request.remote_ip) | ||
end | ||
|
||
def user_for_paper_trail | ||
current_registrant_user.present? ? current_registrant_user.id_role_username : 'anonymous' | ||
end | ||
end |
Oops, something went wrong.