-
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.
feature(change-password):implement change password functionality
[Delivers #167942048]
- Loading branch information
Showing
15 changed files
with
629 additions
and
86 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
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
36 changes: 36 additions & 0 deletions
36
src/database/migrations/20190822133141-create-previous-password.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,36 @@ | ||
const up = (queryInterface, Sequelize) => queryInterface.createTable('PreviousPasswords', { | ||
id: { | ||
allowNull: false, | ||
primaryKey: true, | ||
type: Sequelize.UUID, | ||
}, | ||
userId: { | ||
type: Sequelize.UUID, | ||
onDelete: 'CASCADE', | ||
allowNull: false, | ||
references: { | ||
model: 'Users', | ||
key: 'id' | ||
}, | ||
}, | ||
password: { | ||
allowNull: false, | ||
type: Sequelize.STRING | ||
}, | ||
passwordCount: { | ||
allowNull: false, | ||
type: Sequelize.INTEGER | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
} | ||
}); | ||
|
||
const down = queryInterface => queryInterface.dropTable('PreviousPasswords'); | ||
|
||
export default { up, down }; |
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,42 @@ | ||
export default (Sequelize, DataTypes) => { | ||
const PreviousPassword = Sequelize.define('PreviousPassword', { | ||
id: { | ||
allowNull: false, | ||
primaryKey: true, | ||
type: DataTypes.UUID, | ||
defaultValue: DataTypes.UUIDV4, | ||
}, | ||
userId: { | ||
type: DataTypes.UUID, | ||
onDelete: 'CASCADE', | ||
allowNull: false, | ||
references: { | ||
model: 'Users', | ||
key: 'id' | ||
}, | ||
}, | ||
password: { | ||
allowNull: false, | ||
type: DataTypes.STRING | ||
}, | ||
passwordCount: { | ||
allowNull: false, | ||
type: DataTypes.INTEGER | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: DataTypes.DATE | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: DataTypes.DATE | ||
} | ||
}, {}); | ||
PreviousPassword.associate = (models) => { | ||
PreviousPassword.hasMany(models.Novel, { | ||
foreignKey: 'authorId', | ||
onDelete: 'CASCADE' | ||
}); | ||
}; | ||
return PreviousPassword; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import bcrypt from 'bcrypt'; | ||
|
||
export const up = queryInterface => queryInterface.bulkInsert('PreviousPasswords', [{ | ||
id: 'd0bd6342-3188-4c49-9980-eb8fe7c77b83', | ||
userId: '11fb0350-5b46-4ace-9a5b-e3b788167915', | ||
password: bcrypt.hashSync('pogba1234', 10), | ||
passwordCount: 1, | ||
createdAt: new Date(), | ||
updatedAt: new Date() | ||
}, | ||
{ | ||
id: 'd5347c0c-cba2-46a6-abb2-69c68ce928fe', | ||
userId: '11fb0350-5b46-4ace-9a5b-e3b788167915', | ||
password: bcrypt.hashSync('lionel1234', 10), | ||
passwordCount: 2, | ||
createdAt: new Date(), | ||
updatedAt: new Date() | ||
}, | ||
{ | ||
id: '88f5b93b-b408-454c-bf30-4abb590db6ba', | ||
userId: '11fb0350-5b46-4ace-9a5b-e3b788167915', | ||
password: bcrypt.hashSync('ronaldo1234', 10), | ||
passwordCount: 3, | ||
createdAt: new Date(), | ||
updatedAt: new Date() | ||
}, | ||
{ | ||
id: 'e87df52f-080b-4d9d-8e35-0a8f645ab390', | ||
userId: '11fb0350-5b46-4ace-9a5b-e3b788167915', | ||
password: bcrypt.hashSync('mason1234', 10), | ||
passwordCount: 4, | ||
createdAt: new Date(), | ||
updatedAt: new Date() | ||
}, | ||
{ | ||
id: 'b93e45ff-dab8-4f64-894e-862d174f8416', | ||
userId: '11fb0350-5b46-4ace-9a5b-e3b788167915', | ||
password: bcrypt.hashSync('lampard1234', 10), | ||
passwordCount: 5, | ||
createdAt: new Date(), | ||
updatedAt: new Date() | ||
}, | ||
{ | ||
id: '95dda745-8efa-4342-8ef7-02f80bda1add', | ||
userId: '8487ef08-2ac2-4387-8bd6-738b12c75dff', | ||
password: bcrypt.hashSync('bakayoko1234', 10), | ||
passwordCount: 1, | ||
createdAt: new Date(), | ||
updatedAt: new Date() | ||
}, | ||
{ | ||
id: '9722da61-1c7a-4041-b934-976cef877ddf', | ||
userId: '8487ef08-2ac2-4387-8bd6-738b12c75dff', | ||
password: bcrypt.hashSync('drinkwater1234', 10), | ||
passwordCount: 2, | ||
createdAt: new Date(), | ||
updatedAt: new Date() | ||
}], {}); | ||
export const down = queryInterface => queryInterface.bulkDelete('PreviousPasswords', null, {}); |
Oops, something went wrong.