Skip to content
This repository has been archived by the owner on Jan 17, 2025. It is now read-only.

Commit

Permalink
Clear passcode key in localStorage if auto-login failed
Browse files Browse the repository at this point in the history
  • Loading branch information
bclswl0827 committed Feb 2, 2024
1 parent e841804 commit af95751
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chatgemini",
"version": "0.4.1",
"version": "0.4.2",
"homepage": ".",
"private": true,
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const App = () => {

const handleLogout = () => {
sendUserConfirm("登出后对话记录仍会保留,确定要登出吗?", () => {
sendUserAlert("已退出登入");
sendUserAlert("已成功登出");
setHasLogined(false);
setLocalStorage("passcode", "", false);
});
Expand Down
3 changes: 2 additions & 1 deletion src/components/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ export const LoginForm = (props: LoginFormProps) => {
useEffect(() => {
checkHasLogined().then((hasLogined) => {
if (hasLogined) {
sendUserAlert("自动登入成功");
onPasscodeCorrect();
} else {
// setLocalStorage("passcode", "", false);
setLocalStorage("passcode", "", false);
}
});
}, [checkHasLogined, onPasscodeCorrect]);
Expand Down

0 comments on commit af95751

Please sign in to comment.