Correctly redirect to the referring page when logging in
This commit is contained in:
parent
26fa9ea0ea
commit
767cab6cd2
|
@ -58,6 +58,8 @@ sub login :Local {
|
||||||
$c->stash->{errorMsg} = "Bad username or password.";
|
$c->stash->{errorMsg} = "Bad username or password.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$c->keep_flash("referer");
|
||||||
|
|
||||||
$c->stash->{template} = 'login.tt';
|
$c->stash->{template} = 'login.tt';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,6 @@ sub notFound {
|
||||||
|
|
||||||
sub requireLogin {
|
sub requireLogin {
|
||||||
my ($c) = @_;
|
my ($c) = @_;
|
||||||
$c->flash->{afterLogin} = $c->request->uri;
|
|
||||||
$c->response->redirect($c->uri_for('/login'));
|
$c->response->redirect($c->uri_for('/login'));
|
||||||
$c->detach; # doesn't return
|
$c->detach; # doesn't return
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ You can <a href="[% c.uri_for('/logout') %]">logout</a> here.
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<input type="submit" name="login" value="Sign in" class="btn btn-primary" />
|
<input type="submit" name="login" value="Sign in" class="btn btn-primary" />
|
||||||
</div>
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue