private cloud update 2020-06-14

1. completed i18n for private cloud (foreground and background)
2. fixed issues
This commit is contained in:
strawmanbobi
2020-06-14 11:56:18 +08:00
parent 7fc902a540
commit f94a89faef
28 changed files with 899 additions and 1227 deletions

View File

@@ -4,23 +4,23 @@
*/
require('../mini_poem/configuration/constants');
var Cache = require('../mini_poem/cache/redis.js');
var logger = require('../mini_poem/logging/logger4js').helper;
var Enums = require('../constants/enums');
var ErrorCode = require('../constants/error_code');
let Cache = require('../mini_poem/cache/redis.js');
let logger = require('../mini_poem/logging/logger4js').helper;
let Enums = require('../constants/enums');
let ErrorCode = require('../constants/error_code');
var enums = new Enums();
var errorCode = new ErrorCode();
let enums = new Enums();
let errorCode = new ErrorCode();
var AdminAuth = function(_cacheHost, _cachePort, _cacheAdmin, _cachePassword) {
let AdminAuth = function(_cacheHost, _cachePort, _cacheAdmin, _cachePassword) {
this.cache = new Cache(_cacheHost, _cachePort, _cacheAdmin, _cachePassword);
};
AdminAuth.prototype.setAuthInfo = function(id, token, ttl, callback) {
this.cache.set(id, token, ttl, function(setAdminAuthErr, data) {
var error = errorCode.SUCCESS;
if(setAdminAuthErr != errorCode.SUCCESS.code) {
let error = errorCode.SUCCESS;
if(setAdminAuthErr !== errorCode.SUCCESS.code) {
error = errorCode.FAILED;
}
callback(error, data);
@@ -28,9 +28,9 @@ AdminAuth.prototype.setAuthInfo = function(id, token, ttl, callback) {
};
AdminAuth.prototype.validateAuthInfo = function(id, token, callback) {
var error = errorCode.SUCCESS;
let error = errorCode.SUCCESS;
this.cache.get(id, false, function(getAdminAuthErr, result) {
if(errorCode.SUCCESS.code != getAdminAuthErr || !result || token != result) {
if(errorCode.SUCCESS.code !== getAdminAuthErr || !result || token !== result) {
error = errorCode.AUTHENTICATION_FAILURE;
}
callback(error, result);
@@ -38,9 +38,9 @@ AdminAuth.prototype.validateAuthInfo = function(id, token, callback) {
};
AdminAuth.prototype.getAuthInfo = function(id, callback) {
var error = errorCode.SUCCESS;
let error = errorCode.SUCCESS;
this.cache.get(id, false, function(getAdminAuthErr, result) {
if(errorCode.SUCCESS.code != getAdminAuthErr) {
if(errorCode.SUCCESS.code !== getAdminAuthErr) {
error = errorCode.FAILED;
}
callback(error, result);
@@ -48,9 +48,9 @@ AdminAuth.prototype.getAuthInfo = function(id, callback) {
};
AdminAuth.prototype.deleteAuthInfo = function(id, callback) {
var error = errorCode.SUCCESS;
let error = errorCode.SUCCESS;
this.cache.delete(id, function(deleteAdminAuthErr) {
if(deleteAdminAuthErr != errorCode.SUCCESS.code) {
if(deleteAdminAuthErr !== errorCode.SUCCESS.code) {
error = errorCode.FAILED;
}
callback(error);