mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-19 02:26:27 +00:00
refactor: satisfy linter requirements
This commit is contained in:
@ -88,7 +88,7 @@ module.exports = {
|
||||
* @param {String} [issuer]
|
||||
* @returns {Promise}
|
||||
*/
|
||||
getTokenFromOAuthClaim: (data, issuer) => {
|
||||
getTokenFromOAuthClaim: (data) => {
|
||||
let Token = new TokenModel();
|
||||
|
||||
data.scope = 'user';
|
||||
@ -101,31 +101,26 @@ module.exports = {
|
||||
.andWhere('is_disabled', 0)
|
||||
.first()
|
||||
.then((user) => {
|
||||
if (!user) {
|
||||
throw new error.AuthError('No relevant user found');
|
||||
}
|
||||
|
||||
// Create a moment of the expiry expression
|
||||
let expiry = helpers.parseDatePeriod(data.expiry);
|
||||
if (expiry === null) {
|
||||
throw new error.AuthError('Invalid expiry time: ' + data.expiry);
|
||||
}
|
||||
|
||||
let iss = 'api',
|
||||
attrs = { id: user.id },
|
||||
scope = [ data.scope ],
|
||||
expiresIn = data.expiry;
|
||||
|
||||
return Token.create({ iss, attrs, scope, expiresIn })
|
||||
.then((signed) => {
|
||||
return {
|
||||
token: signed.token,
|
||||
expires: expiry.toISOString()
|
||||
};
|
||||
});
|
||||
|
||||
if (!user) {
|
||||
throw new error.AuthError('No relevant user found');
|
||||
}
|
||||
);
|
||||
|
||||
// Create a moment of the expiry expression
|
||||
let expiry = helpers.parseDatePeriod(data.expiry);
|
||||
if (expiry === null) {
|
||||
throw new error.AuthError('Invalid expiry time: ' + data.expiry);
|
||||
}
|
||||
|
||||
let iss = 'api',
|
||||
attrs = { id: user.id },
|
||||
scope = [ data.scope ],
|
||||
expiresIn = data.expiry;
|
||||
|
||||
return Token.create({ iss, attrs, scope, expiresIn })
|
||||
.then((signed) => {
|
||||
return { token: signed.token, expires: expiry.toISOString() };
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user