diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-07-08 15:22:32 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-07-08 15:22:32 -0500 |
| commit | 72690f587e3c1f01fc530638781bd129f7d61fea (patch) | |
| tree | b709c2ade27f4eda1f3cc1624d6b5a4300152fd8 | |
| parent | 4671bcf71aac18670fe371febb3b8dddc74a9539 (diff) | |
| download | invidious-72690f587e3c1f01fc530638781bd129f7d61fea.tar.gz invidious-72690f587e3c1f01fc530638781bd129f7d61fea.tar.bz2 invidious-72690f587e3c1f01fc530638781bd129f7d61fea.zip | |
Clarify request types
| -rw-r--r-- | src/invidious.cr | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index f03c3e87..34900d6d 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -525,12 +525,16 @@ post "/login" do |env| tl = challenge_results[1][2] request_type = tfa[8] - if request_type == 6 - # Google Authenticator code + case request_type + when 6 + # Authenticator app tfa_req = %(["#{user_hash}",null,2,null,[6,null,null,null,null,["#{tfa_code}",false]]]) - else - # SMS + when 9 + # Voice or text message 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 challenge_results = client.post("/_/signin/challenge?hl=en&TL=#{tl}", headers, login_req(inputs, tfa_req)) |
