diff options
Diffstat (limited to 'app/controllers/sessions_controller.rb')
-rw-r--r-- | app/controllers/sessions_controller.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 784647c..cb8dcef 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -21,6 +21,10 @@ class SessionsController < ApplicationController flash[:alert] = "Your account has been disabled!" elsif user.banned? flash[:alert] = "You are banned!" + elsif user.totp_enabled && !TOTP.valid?(user.totp_secret, params[:totp_code].to_i) + flash[:alert] = "You're doing it wrong!" + render action: 'new' + return else session[:user_id] = user.id flash[:notice] = "Logged in!" @@ -110,4 +114,4 @@ class SessionsController < ApplicationController redirect_to login_path end end -end
\ No newline at end of file +end |