remember last instance for 2 weeks

master
Benjamin Schieder 2017-04-26 07:45:34 +01:00
parent 6af8cd9ba0
commit e48e2d0d15
3 changed files with 4 additions and 1 deletions

View File

@ -20,6 +20,8 @@ sub prerender {
$self->{"template"} = "Login"; $self->{"template"} = "Login";
$self->{"content_type"} = "html"; $self->{"content_type"} = "html";
$self->{"params"}->{"currentmode"} = "Login"; $self->{"params"}->{"currentmode"} = "Login";
$self->{"params"}->{"instance"} = $main::FORM{"last_instance"};
} }
1; 1;

View File

@ -40,6 +40,7 @@ sub prerender {
my $user = RSSTootalizer::User->authenticate(); my $user = RSSTootalizer::User->authenticate();
if ($user){ if ($user){
$self->{params}->{token_is_valid} = "true"; $self->{params}->{token_is_valid} = "true";
$self->{set_cookie} = ("last_instance=$instance; Max-Age=1209600");
} }
# {"error":"The access token is invalid"} # {"error":"The access token is invalid"}
} }

View File

@ -4,7 +4,7 @@
<form class="form-signin" method="POST" action="index.pl"> <form class="form-signin" method="POST" action="index.pl">
<h2 class="form-signin-heading">Please enter your Mastodon instance URL</h2> <h2 class="form-signin-heading">Please enter your Mastodon instance URL</h2>
<label for="inputUsername" class="sr-only">Mastodon instance URL</label> <label for="inputUsername" class="sr-only">Mastodon instance URL</label>
<input type="url" id="inputInstance" name="inputInstance" class="form-control" placeholder="https://mastodon.social" required autofocus> <input type="url" id="inputInstance" name="inputInstance" class="form-control" placeholder="https://mastodon.social" value="<TMPL_VAR NAME="instance">" required autofocus>
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button> <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
<input type="hidden" id="mode" name="mode" value="OAuthLogin"> <input type="hidden" id="mode" name="mode" value="OAuthLogin">