Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- reg(login, password, pdata, role) {
- return User.findOne({where: {login}})
- .then(_user => {
- if (_user) {
- throw new Error("Login is exist");
- }
- this.correctRole(role);
- return User.create(
- Object.assign(
- {
- login,
- role
- },
- pdata,
- {
- password: SHA256(password + this.secretKey).toString()
- }
- )
- );
- })
- .then(() => {
- return this.auth(login, password);
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement