Skip to content

Commit

Permalink
Re-enabled support for redirect after log in
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmerfield committed Jan 11, 2019
1 parent 6f8b94f commit be632d6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/dashboard/routes/log_in.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ function checkEmail (req, res, next) {

req.user = user;
res.locals.email = user.email;
res.locals.then = req.query.then;

next();
});
Expand Down Expand Up @@ -190,7 +191,7 @@ function checkPassword (req, res, next) {

var user = req.user;
var password = req.body && req.body.password;
var then = (req.query && req.query.then) || '/';
var then = req.query.then || req.body.then || '/';

if (password === '') {
return next(new LogInError('NOPASSWORD'));
Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/views/log-in-email.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{{/error}}
</div>

<form style="max-width:18rem" method="POST" action="?_csrf={{csrf}}">
<form style="max-width:18rem" method="POST">

<label class="pt3 db" for="email">Your email address</label>
<input class="w-100 mt1 mb3 br2 pa2 ba b--black-30" id="email" type="text" size="20" class="email" name="email" autofocus/>
Expand Down
5 changes: 3 additions & 2 deletions app/dashboard/views/log-in-password.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<div class="w-right-offset">

<form method="POST" action="?_csrf={{csrf}}">
<form method="POST">

<input type="hidden" name="email" value="{{email}}" />

Expand All @@ -25,9 +25,10 @@

</form>

<form style="max-width:18rem" method="POST" action="?_csrf={{csrf}}">
<form style="max-width:18rem" method="POST">

<label class="pt3 db" for="email">Your password</label>
<input type="hidden" name="then" value="{{then}}" />
<input type="hidden" name="email" value="{{email}}" />
<input class="w-100 mt1 mb3 br2 pa2 ba b--black-30" id="password" type="password" name="password" autofocus/>

Expand Down

0 comments on commit be632d6

Please sign in to comment.