Merge pull request #42 from omarroth/change-default-account

Change default account type to Invidious accounts
This commit is contained in:
Omar Roth 2018-07-26 18:00:36 -05:00 committed by GitHub
commit f98d30d36f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 22 deletions

View File

@ -1031,7 +1031,7 @@ get "/login" do |env|
referer ||= "/feed/subscriptions"
account_type = env.params.query["type"]?
account_type ||= "google"
account_type ||= "invidious"
if account_type == "invidious"
captcha = generate_captcha(HMAC_KEY)
@ -1148,7 +1148,7 @@ post "/login" do |env|
end
if !tfa_code
next env.redirect "/login?tfa=true"
next env.redirect "/login?tfa=true&type=google"
end
tl = challenge_results[1][2]

View File

@ -8,31 +8,14 @@
<div class="h-box">
<div class="pure-g">
<div class="pure-u-1-2">
<a class="pure-button <% if account_type == "google" %>pure-button-disabled<% end %>" href="/login">Login to Google</a>
<a class="pure-button <% if account_type == "invidious" %>pure-button-disabled<% end %>" href="/login">Login/Register</a>
</div>
<div class="pure-u-1-2">
<a class="pure-button <% if account_type == "invidious" %>pure-button-disabled<% end %>" href="/login?type=invidious">Login/Register</a>
<a class="pure-button <% if account_type == "google" %>pure-button-disabled<% end %>" href="/login?type=google">Login to Google</a>
</div>
</div>
<hr>
<% if account_type == "google" %>
<form class="pure-form pure-form-stacked" action="/login?referer=<%= referer %>" method="post">
<fieldset>
<label for="email">Email:</label>
<input required class="pure-input-1" name="email" type="email" placeholder="Email">
<label for="password">Password:</label>
<input required class="pure-input-1" name="password" type="password" placeholder="Password">
<% if tfa %>
<label for="tfa">Google verification code:</label>
<input required class="pure-input-1" name="tfa" type="text" placeholder="Google verification code">
<% end %>
<button type="submit" class="pure-button pure-button-primary">Sign in</button>
</fieldset>
</form>
<% elsif account_type == "invidious" %>
<% if account_type == "invidious" %>
<form class="pure-form pure-form-stacked" action="/login?referer=<%= referer %>&type=invidious" method="post">
<fieldset>
<label for="email">User ID:</label>
@ -50,6 +33,23 @@
<button type="submit" name="action" value="register" class="pure-button pure-button-primary">Register</button>
</fieldset>
</form>
<% elsif account_type == "google" %>
<form class="pure-form pure-form-stacked" action="/login?referer=<%= referer %>" method="post">
<fieldset>
<label for="email">Email:</label>
<input required class="pure-input-1" name="email" type="email" placeholder="Email">
<label for="password">Password:</label>
<input required class="pure-input-1" name="password" type="password" placeholder="Password">
<% if tfa %>
<label for="tfa">Google verification code:</label>
<input required class="pure-input-1" name="tfa" type="text" placeholder="Google verification code">
<% end %>
<button type="submit" class="pure-button pure-button-primary">Sign in</button>
</fieldset>
</form>
<% end %>
</div>
</div>