mirror of
https://github.com/MCSManager/MCSManager.git
synced 2025-01-18 15:04:04 +08:00
39 lines
966 B
JavaScript
39 lines
966 B
JavaScript
|
const { USER_SAVE_PATH, User } = require('../core/User/User');
|
||
|
|
||
|
const UserCenter = require('../core/User/UserCenter');
|
||
|
const fs = require('fs');
|
||
|
|
||
|
let userCenters = new UserCenter();
|
||
|
module.exports.userCenter = () => {
|
||
|
return userCenters;
|
||
|
}
|
||
|
|
||
|
module.exports.registerUser = (username, password) => {
|
||
|
return userCenters.register(username, password);
|
||
|
}
|
||
|
|
||
|
|
||
|
module.exports.loginUser = (username, password, truecb, falsecb,enkey) => {
|
||
|
return userCenters.loginCheck(username, password, truecb, falsecb,enkey);
|
||
|
}
|
||
|
|
||
|
|
||
|
module.exports.deleteUser = (username, truecb, falsecb) => {
|
||
|
try {
|
||
|
if (userCenters.deleteUser(username)) {
|
||
|
truecb && truecb();
|
||
|
return;
|
||
|
}
|
||
|
falsecb && falsecb();
|
||
|
} catch (e) {
|
||
|
MCSERVER.log(e);
|
||
|
falsecb && falsecb();
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
module.exports.reAllowedServer = (username, list) => {
|
||
|
return userCenters.get(username)
|
||
|
.allowedServer(list)
|
||
|
.save();
|
||
|
}
|