-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created Client::BaseController to hide layout and logged_in filters
This way increasing the chances of forgetting to ensure logging in.
- Loading branch information
1 parent
afb025f
commit 252f99e
Showing
4 changed files
with
22 additions
and
16 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
rails_application/app/controllers/client/base_controller.rb
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,16 @@ | ||
module Client | ||
class BaseController < ApplicationController | ||
|
||
layout "client_panel" | ||
before_action :ensure_logged_in | ||
|
||
private | ||
|
||
def ensure_logged_in | ||
if ClientOrders::Client.find_by(uid: cookies[:client_id]).nil? | ||
redirect_to logout_path | ||
return | ||
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
13 changes: 1 addition & 12 deletions
13
rails_application/app/controllers/client/orders_controller.rb
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
3 changes: 1 addition & 2 deletions
3
rails_application/app/controllers/client/products_controller.rb
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