Skip to content

Commit

Permalink
Merge pull request #239 from nicolaslabbe/fix/bug-forgot-password
Browse files Browse the repository at this point in the history
Fix: bug forgot password
  • Loading branch information
gregorybesson committed Oct 12, 2017
2 parents f3869b1 + a3671ca commit e903043
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/server/routes/users/get/forgot.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ var route = function route(req, res) {
return res.status(200).json({success: 1})
}

if (!user) {
return showHtml(res, req, 'Email not found')
}

crypto.randomBytes(20, function(err, buf) {
var resetPasswordToken = buf.toString('hex')
var forgotExpire = config.forgotExpire
Expand Down
6 changes: 2 additions & 4 deletions src/server/views/users/forgot.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
<div class="panel-body">
{{#if info}}
<span class="text-danger">{{@root.info}}</span>
<br /><br />
<a href="/abe/users/login">Login</a>
{{else}}
<br />
{{/if}}
<form action="/abe/users/forgot" method="get">

<div class="form-group">
Expand All @@ -24,7 +23,6 @@
<input type="hidden" class="form-control" name="token" value="{{token}}">
<button type="submit" class="btn btn-default">Submit</button>
</form>
{{/if}}

{{abeImport 'login-more' config this}}
</div>
Expand Down

0 comments on commit e903043

Please sign in to comment.