Added user verif method and refactored some indents
This commit is contained in:
@@ -151,6 +151,37 @@ class UserRepository {
|
||||
})
|
||||
}
|
||||
|
||||
verifyUser(token) {
|
||||
return new Promise((resolve, reject) => {
|
||||
model.forge()
|
||||
.where({ 'verification_token' : token })
|
||||
.fetch()
|
||||
.then(v => {
|
||||
bookshelf.transaction(t => {
|
||||
return v.save({
|
||||
'verification_token': null,
|
||||
'verified': 1,
|
||||
}, {
|
||||
method: 'update',
|
||||
transacting: t
|
||||
})
|
||||
})
|
||||
.then(v => {
|
||||
resolve({
|
||||
"message": "Insérez ici une future redirection vers le client.",
|
||||
"code": 202,
|
||||
})
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
reject({
|
||||
"message": "Le lien de vérification ne semble pas correct.",
|
||||
"code": 404
|
||||
})
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// Log user with an email address and a password
|
||||
logUser(mail, password) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
Reference in New Issue
Block a user