Skip to content

Commit

Permalink
#19 - Backend to reset password
Browse files Browse the repository at this point in the history
  • Loading branch information
daniloaf committed May 12, 2017
1 parent 8b24de8 commit 0e4b5fa
Show file tree
Hide file tree
Showing 8 changed files with 342 additions and 207 deletions.
508 changes: 303 additions & 205 deletions app/routes.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion config/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
'connection': {
'host': 'localhost',
'user': 'root',
'password': 'test'
'password': ''
},
'database': 'rda_schema',
'users_table': 'users',
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"homepage": "https://github.com/offthread/society-suite#readme",
"dependencies": {
"async": "^2.4.0",
"bcrypt-nodejs": "0.0.3",
"body-parser": "^1.17.1",
"connect-flash": "^0.1.1",
Expand All @@ -32,7 +33,8 @@
"mysql": "^2.13.0",
"node-crontab": "0.0.8",
"passport": "^0.3.2",
"passport-local": "^1.0.0"
"passport-local": "^1.0.0",
"randomstring": "^1.1.5"
},
"engines": {
"node": "4.2.6"
Expand Down
2 changes: 2 additions & 0 deletions scripts/create_database_schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ CREATE TABLE `' + dbconfig.database + '`.`' + dbconfig.users_table + '` ( \
`password` CHAR(60) NOT NULL, \
`picture` VARCHAR(500) NOT NULL, \
`is_admin` TINYINT(1) NOT NULL, \
`email` VARCHAR(50), \
`reset_token` VARCHAR(32), \
PRIMARY KEY (`id`), \
UNIQUE INDEX `id_UNIQUE` (`id` ASC), \
UNIQUE INDEX `username_UNIQUE` (`username` ASC) \
Expand Down
3 changes: 3 additions & 0 deletions scripts/migrations/database/01-reset-password.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE `users`
ADD COLUMN `email` VARCHAR(50),
ADD COLUMN `reset_token` VARCHAR(32);
14 changes: 14 additions & 0 deletions views/misc/forgot-password.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<html>
<head>

</head>
<body>
<form action="/forgot-password" method="POST">
<div>
<label for="email">Email:</label>
<input type="text" id="email" placeholder="Email" name="email" required />
<button type="submit">Enviar</button>
</div>
</form>
</body>
</html>
1 change: 1 addition & 0 deletions views/misc/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ <h1 class="main-area-text text-center">Log In</h1>

<br>
</form>
<a href="/forgot-password">Esqueci minha senha</a>
</div>
</div>
</div>
Expand Down
15 changes: 15 additions & 0 deletions views/misc/reset-password.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<html>
<head>

</head>
<body>
<form method="POST">
<div>
<label for="email">Email:</label>
<input type="password" id="password" placeholder="Senha" name="password" required />
<input type="password" id="passwordConfirm" placeholder="Confirmar senha" name="passwordConfirm" required />
<button type="submit">Redefinir senha</button>
</div>
</form>
</body>
</html>

0 comments on commit 0e4b5fa

Please sign in to comment.