refactored user.ts
This commit is contained in:
@ -63,7 +63,7 @@ function basic (req, next): any { // checks basic auth and returns changed user
|
||||
if (data.length === 1) { // one user found
|
||||
bcrypt.compare(auth.pass, data[0].pass, (err, res) => { // check password
|
||||
if (err) return next(err);
|
||||
if (res === true) {
|
||||
if (res === true) { // password correct
|
||||
resolve({level: data[0].level, name: data[0].name, id: data[0]._id.toString(), location: data[0].location});
|
||||
}
|
||||
else {
|
||||
@ -84,7 +84,7 @@ function basic (req, next): any { // checks basic auth and returns changed user
|
||||
|
||||
function key (req, next): any { // checks API key and returns changed user object
|
||||
return new Promise(resolve => {
|
||||
if (req.query.key !== undefined) {
|
||||
if (req.query.key !== undefined) { // key available
|
||||
UserModel.find({key: req.query.key}).lean().exec( (err, data: any) => { // find user
|
||||
if (err) return next(err);
|
||||
if (data.length === 1) { // one user found
|
||||
|
@ -1,6 +1,6 @@
|
||||
import axios from 'axios';
|
||||
|
||||
// sends an email
|
||||
// sends an email using the BIC service
|
||||
|
||||
export default (mailAddress, subject, content, f) => { // callback, executed empty or with error
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
|
Reference in New Issue
Block a user