diff options
author | Marius Peter <marius.peter@tutanota.com> | 2024-12-31 19:31:37 +0100 |
---|---|---|
committer | Marius Peter <marius.peter@tutanota.com> | 2024-12-31 19:31:37 +0100 |
commit | bcd73c5548666bae7fef57e7e22cb61126308259 (patch) | |
tree | 4a4e54709775344d1b9ffc49ae0689c8f1884d70 /app/controllers/sessions_controller.rb | |
parent | e03e7b2c3fd8d5bc97d9ca46594ec6dc689bce64 (diff) |
megaPush 😈
Diffstat (limited to 'app/controllers/sessions_controller.rb')
-rw-r--r-- | app/controllers/sessions_controller.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index fad2c4b..3dc076b 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,5 +1,5 @@ class SessionsController < ApplicationController - allow_unauthenticated_access only: %i[ new create dismiss_banner ] + allow_unauthenticated_access only: %i[ new create accept_cookies gift_nico ] rate_limit to: 10, within: 3.minutes, only: :create, with: -> { redirect_to new_session_url, alert: "Try again later." } def new @@ -8,6 +8,9 @@ class SessionsController < ApplicationController def create if user = User.authenticate_by(params.permit(:email_address, :password)) start_new_session_for user + if user.admin + session[:admin] = true + end redirect_to after_authentication_url else redirect_to new_session_path, alert: "Try another email address or password." @@ -23,4 +26,14 @@ class SessionsController < ApplicationController session[:dismissed_banner] = true redirect_to root_path end + + def accept_cookies + session[:dismissed_banner] = true + redirect_to root_path + end + + def gift_nico + session[:dismissed_banner] = true + redirect_to root_path + end end |