ref: Remove board types, refactoring

This commit is contained in:
Maksim Eltyshev
2022-12-26 21:10:50 +01:00
parent 2b131f76c1
commit 6ffa817b53
182 changed files with 1573 additions and 1239 deletions

View File

@@ -9,6 +9,8 @@ const Errors = {
},
};
const passwordValidator = (value) => zxcvbn(value).score >= 2; // TODO: move to config
module.exports = {
inputs: {
email: {
@@ -18,7 +20,7 @@ module.exports = {
},
password: {
type: 'string',
custom: (value) => zxcvbn(value).score >= 2, // TODO: move to config
custom: passwordValidator,
required: true,
},
name: {
@@ -74,8 +76,11 @@ module.exports = {
'subscribeToOwnCards',
]);
const user = await sails.helpers.users
.createOne(values, this.req)
const user = await sails.helpers.users.createOne
.with({
values,
request: this.req,
})
.intercept('emailAlreadyInUse', () => Errors.EMAIL_ALREADY_IN_USE)
.intercept('usernameAlreadyInUse', () => Errors.USERNAME_ALREADY_IN_USE);