Added TOTP field to login screen.

This commit is contained in:
Logan Fick
2018-06-07 20:31:11 -04:00
parent a241749ee3
commit 6d22462d7a
2 changed files with 13 additions and 1 deletions

View File

@@ -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.verify?(user.totp_code, params[:totp_code])
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
end