MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / edit

Method edit

panel/src/app/service/user_service.ts:41–60  ·  view source on GitHub ↗
(uuid: string, config: any)

Source from the content-addressed store, hash-verified

39
40 // Update user detail
41 async edit(uuid: string, config: any) {
42 const instance = this.getInstance(uuid);
43 if (!instance) return;
44 if (config.userName) instance.userName = config.userName;
45 if (config.isInit != null) instance.isInit = Boolean(config.isInit);
46 if (config.permission) instance.permission = config.permission;
47 if (config.registerTime) instance.registerTime = config.registerTime;
48 if (config.loginTime) instance.loginTime = config.loginTime;
49 if (config.apiKey != null) instance.apiKey = config.apiKey;
50 if (config.secret != null) instance.secret = String(config.secret);
51 if (config.open2FA != null) instance.open2FA = Boolean(config.open2FA);
52 if (config.ssoSub != null) instance.ssoSub = String(config.ssoSub);
53 if (config.ssoBound != null) instance.ssoBound = Boolean(config.ssoBound);
54 if (config.instances) this.setUserInstances(uuid, config.instances);
55 if (config.passWord) {
56 instance.passWordType = UserPassWordType.bcrypt;
57 instance.passWord = bcrypt.hashSync(config.passWord, 10);
58 }
59 await Storage.getStorage().store("User", uuid, instance);
60 }
61
62 validatePassword(password = "") {
63 if (password.length < 9 || password.length > 36) return false;

Callers 7

createMethod · 0.95
bind2FAFunction · 0.45
confirm2FaQRCodeFunction · 0.45
buyOrRenewInstanceFunction · 0.45
daemon_router.tsFile · 0.45

Calls 4

getInstanceMethod · 0.95
setUserInstancesMethod · 0.95
getStorageMethod · 0.80
storeMethod · 0.65

Tested by

no test coverage detected