Sync DNS2 production changes - removed obsolete test suite and refactored structure
This commit is contained in:
@@ -16,7 +16,7 @@ module.exports = function(ctx) {
|
||||
m: 60 * 1000,
|
||||
h: 60 * 60 * 1000,
|
||||
d: 24 * 60 * 60 * 1000,
|
||||
y: 365 * 24 * 60 * 60 * 1000,
|
||||
y: 365 * 24 * 60 * 60 * 1000
|
||||
};
|
||||
|
||||
return value * (multipliers[unit] || multipliers.h);
|
||||
@@ -54,7 +54,7 @@ module.exports = function(ctx) {
|
||||
|
||||
const keyData = await ctx.authManager.generateAPIKey(
|
||||
name.trim(),
|
||||
scopes || ['read', 'write'],
|
||||
scopes || ['read', 'write']
|
||||
);
|
||||
|
||||
res.json({
|
||||
@@ -64,7 +64,7 @@ module.exports = function(ctx) {
|
||||
name: keyData.name,
|
||||
scopes: keyData.scopes,
|
||||
createdAt: keyData.createdAt,
|
||||
warning: 'Save this key securely - it will not be shown again',
|
||||
warning: 'Save this key securely - it will not be shown again'
|
||||
});
|
||||
}, 'auth-keys-generate'));
|
||||
|
||||
@@ -109,9 +109,9 @@ module.exports = function(ctx) {
|
||||
const token = await ctx.authManager.generateJWT(
|
||||
{
|
||||
sub: userId || 'dashcaddy-admin',
|
||||
scope: ['admin'], // Session-generated JWTs have admin scope
|
||||
scope: ['admin'] // Session-generated JWTs have admin scope
|
||||
},
|
||||
expiresIn || '24h',
|
||||
expiresIn || '24h'
|
||||
);
|
||||
|
||||
// Calculate expiration timestamp
|
||||
@@ -122,7 +122,7 @@ module.exports = function(ctx) {
|
||||
success: true,
|
||||
token,
|
||||
expiresAt,
|
||||
usage: 'Include in Authorization header as: Bearer <token>',
|
||||
usage: 'Include in Authorization header as: Bearer <token>'
|
||||
});
|
||||
}, 'auth-jwt-generate'));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user