Version 0.2.0 - PREVERSION - Ajout de certaines fonctionnalités
All checks were successful
Neutral/pipeline/head This commit looks good
All checks were successful
Neutral/pipeline/head This commit looks good
This commit is contained in:
24
bin/auth.js
24
bin/auth.js
@ -23,7 +23,6 @@ module.exports.check = function(token) {
|
||||
})
|
||||
|
||||
if(isApproved) {
|
||||
alog.log("Connexion par Token de l'utilisateur : " + username)
|
||||
return true
|
||||
} else {
|
||||
if(token) {
|
||||
@ -88,4 +87,27 @@ module.exports.signout = function(token) {
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports.getUserByToken = function(token) {
|
||||
var isApproved = false;
|
||||
var userGetted = null
|
||||
users.getUsers().forEach((fetchUser) => {
|
||||
if(fetchUser.tokens.includes(token)) {
|
||||
userGetted = fetchUser
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
if(userGetted) {
|
||||
return userGetted
|
||||
|
||||
} else {
|
||||
if(token) {
|
||||
|
||||
alog.warn("Erreur d'authentification - Token n'existe pas : " + token)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user