Browse files

readme

  • Loading branch information...
0 parents commit e98e61164d0ca6970d4a431a8f355dcdbfe66ff8 @zemirco committed Oct 3, 2013
Showing with 48 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +45 −0 README.md
3 .gitignore
@@ -0,0 +1,3 @@
+.idea/
+node_modules/
+.DS_Store
45 README.md
@@ -0,0 +1,45 @@
+## What do I get?
+
+ - [GET /forgot-password](#get-forgot-password)
+ - [POST /forgot-password](#post-forgot-password)
+ - [GET /forgot-password/:token]()
+ - [POST /forgot-password/:token]()
+
+#### GET /forgot-password
+
+ - render `get-forgot-password` template with input field for `email`
+
+#### POST /forgot-password
+
+ - verify that `email` isn't empty and is a valid email address
+ - find user with given `email` in database
+ - no user found -> render `post-forgot-password` template with success message to pretend we've sent an email
+ - delete old password hash
+ - create the `token` and expiration date for `token`
+ - save new user details to db
+ - send an email with link containing the `token`
+ - render `post-forgot-password` template containing success message
+
+#### GET /forgot-password/:token
+
+ - verify format of `token`
+ - `token` has the wrong format -> continue with error handling middleware
+ - find user with given `token` in db
+ - no user found -> continue with error handling middleware
+ - check if token has expired
+ - token has expired -> delete token and token expiration date for user
+ - token has expired -> save user to db and render `link-expired` template
+ - render `get-new-password` template with input field for `password`
+
+#### POST /forgot-password/:token
+
+ - check for `token`
+ - no `token` found -> continue with error handling middleware
+ - verify format of `token`
+ - `token` has the wrong format -> continue with error handling middleware
+ - find user with given `token` in db
+ - no user found -> continue with error handling middleware
+ - create hash of given `password` with bcrypt
+ - delete token and token expiration date for user
+ - save new user details to db
+ - render `change-password-success` template with success message

0 comments on commit e98e611

Please sign in to comment.