Merge pull request #42 from omarroth/change-default-account
Change default account type to Invidious accounts
This commit is contained in:
commit
f98d30d36f
|
@ -1031,7 +1031,7 @@ get "/login" do |env|
|
||||||
referer ||= "/feed/subscriptions"
|
referer ||= "/feed/subscriptions"
|
||||||
|
|
||||||
account_type = env.params.query["type"]?
|
account_type = env.params.query["type"]?
|
||||||
account_type ||= "google"
|
account_type ||= "invidious"
|
||||||
|
|
||||||
if account_type == "invidious"
|
if account_type == "invidious"
|
||||||
captcha = generate_captcha(HMAC_KEY)
|
captcha = generate_captcha(HMAC_KEY)
|
||||||
|
@ -1148,7 +1148,7 @@ post "/login" do |env|
|
||||||
end
|
end
|
||||||
|
|
||||||
if !tfa_code
|
if !tfa_code
|
||||||
next env.redirect "/login?tfa=true"
|
next env.redirect "/login?tfa=true&type=google"
|
||||||
end
|
end
|
||||||
|
|
||||||
tl = challenge_results[1][2]
|
tl = challenge_results[1][2]
|
||||||
|
|
|
@ -8,31 +8,14 @@
|
||||||
<div class="h-box">
|
<div class="h-box">
|
||||||
<div class="pure-g">
|
<div class="pure-g">
|
||||||
<div class="pure-u-1-2">
|
<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>
|
||||||
<div class="pure-u-1-2">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<% if account_type == "google" %>
|
<% if account_type == "invidious" %>
|
||||||
<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" %>
|
|
||||||
<form class="pure-form pure-form-stacked" action="/login?referer=<%= referer %>&type=invidious" method="post">
|
<form class="pure-form pure-form-stacked" action="/login?referer=<%= referer %>&type=invidious" method="post">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="email">User ID:</label>
|
<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>
|
<button type="submit" name="action" value="register" class="pure-button pure-button-primary">Register</button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</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 %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue