修复用户名密码修改,diff视图滚动

This commit is contained in:
whyour 2021-03-21 11:57:00 +08:00
parent f03323e5d8
commit ecb5bb1718
6 changed files with 33 additions and 20 deletions

View File

@ -25,12 +25,12 @@ export default (app: Router) => {
config.secret as any,
{ expiresIn: 60 * 60 * 24 * 7, algorithm: 'HS384' },
);
res.send({ err: 0, token });
res.send({ code: 200, token });
} else {
res.send({ err: 1, msg: config.authError });
res.send({ code: 400, msg: config.authError });
}
} else {
res.send({ err: 1, msg: '请输入用户名密码!' });
res.send({ err: 400, msg: '请输入用户名密码!' });
}
});
} catch (e) {
@ -39,4 +39,20 @@ export default (app: Router) => {
}
},
);
route.post(
'/user',
async (req: Request, res: Response, next: NextFunction) => {
const logger: Logger = Container.get('logger');
try {
fs.writeFile(config.authConfigFile, JSON.stringify(req.body), (err) => {
if (err) console.log(err);
res.send({ code: 200, msg: '更新成功' });
});
} catch (e) {
logger.error('🔥 error: %o', e);
return next(e);
}
},
);
};

View File

@ -63,6 +63,7 @@
"react": "17.x",
"react-dom": "17.x",
"typescript": "^4.1.2",
"yorkie": "^2.0.0"
"yorkie": "^2.0.0",
"ts-node": "^9.0.0"
}
}

View File

@ -88,10 +88,10 @@ function Git_PullScripts {
echo -e "更新scripts...\n"
cd ${ScriptsDir}
git fetch --all
git rm -f i-chenzhe*
git rm -f moposmall*
git rm -f qq34347476*
git rm -f whyour*
git rm -f --ignore-unmatch i-chenzhe*
git rm -f --ignore-unmatch moposmall*
git rm -f --ignore-unmatch qq34347476*
git rm -f --ignore-unmatch whyour*
git stash
git pull
ExitStatusScripts=$?

View File

@ -18,7 +18,7 @@ body {
overflow: auto;
.ant-pro-page-container-children-content {
overflow: auto;
min-height: calc(100vh - 96px);
height: calc(100vh - 96px);
background-color: #fff;
}
}

View File

@ -18,7 +18,7 @@ const Login = () => {
},
})
.then((data) => {
if (data.err == 0) {
if (data.code == 200) {
localStorage.setItem(config.authKey, data.token);
history.push('/cookie');
} else {

View File

@ -29,22 +29,18 @@ const Password = () => {
const handleOk = (values: any) => {
request
.post(`${config.apiPrefix}auth?t=${Date.now()}`, {
.post(`${config.apiPrefix}user?t=${Date.now()}`, {
data: {
username: values.username,
password: values.password,
},
})
.then((data) => {
if (data.err == 0) {
localStorage.setItem(config.authKey, 'true');
} else {
notification.open({
message: data.msg,
});
}
.then((data: any) => {
notification.success({
message: data.msg,
});
})
.catch(function (error) {
.catch((error: any) => {
console.log(error);
});
};