-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
166816202-feat(auth): Signup email verification
- setup nodemailer - update user model - update user controller - add mailer utils - add activation controller to verify email token - add tests - add sinon for mocking mail [Delivers #166816202]
- Loading branch information
1 parent
6a55c06
commit e2af673
Showing
13 changed files
with
200 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
db/migrations/20190701152259-alter-users-add-emailVerificationToken.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
|
||
module.exports = { | ||
up: (queryInterface, Sequelize) => queryInterface | ||
.addColumn('Users', 'emailVerificationToken', { | ||
type: Sequelize.STRING, | ||
allowNull: true | ||
}) | ||
.then(() => queryInterface.addColumn('Users', 'activated', { | ||
type: Sequelize.BOOLEAN, | ||
allowNull: false, | ||
defaultValue: false | ||
})), | ||
down: queryInterface => queryInterface | ||
.removeColumn('Users', 'emailVerificationToken') | ||
.then(() => queryInterface.removeColumn('Users', 'activated')) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import express from 'express'; | ||
import Validation from '../../validators/users'; | ||
import Controller from '../../controllers/users'; | ||
import User from '../../controllers/users'; | ||
import Middleware from '../../middlewares'; | ||
|
||
const router = express.Router(); | ||
|
||
router.post('/signup', Validation.signUp, Controller.signUp); | ||
router.post('/login', Validation.logIn, Controller.logIn); | ||
router.post('/signout', Middleware.authenticate, Middleware.isblackListedToken, Controller.signOut); | ||
router.post('/signup', Validation.signUp, User.signUp); | ||
router.post('/login', Validation.logIn, User.logIn); | ||
router.post('/signout', Middleware.authenticate, Middleware.isblackListedToken, User.signOut); | ||
router.put(`/activate/:token`, User.activate); | ||
|
||
export default router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default () => ({ | ||
secret: process.env.JWT_SECRET || 'secret' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.