Clarify request types

This commit is contained in:
Omar Roth 2018-07-08 15:22:32 -05:00
parent 4671bcf71a
commit 72690f587e

View file

@ -525,12 +525,16 @@ post "/login" do |env|
tl = challenge_results[1][2] tl = challenge_results[1][2]
request_type = tfa[8] request_type = tfa[8]
if request_type == 6 case request_type
# Google Authenticator code when 6
# Authenticator app
tfa_req = %(["#{user_hash}",null,2,null,[6,null,null,null,null,["#{tfa_code}",false]]]) tfa_req = %(["#{user_hash}",null,2,null,[6,null,null,null,null,["#{tfa_code}",false]]])
else when 9
# SMS # Voice or text message
tfa_req = %(["#{user_hash}",null,2,null,[9,null,null,null,null,null,null,null,[null,"#{tfa_code}",false,2]]]) tfa_req = %(["#{user_hash}",null,2,null,[9,null,null,null,null,null,null,null,[null,"#{tfa_code}",false,2]]])
else
error_message = "Unable to login, make sure two-factor authentication (Authenticator or SMS) is enabled."
next templated "error"
end end
challenge_results = client.post("/_/signin/challenge?hl=en&TL=#{tl}", headers, login_req(inputs, tfa_req)) challenge_results = client.post("/_/signin/challenge?hl=en&TL=#{tl}", headers, login_req(inputs, tfa_req))