mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
feat: add support for remember sign in (#2402)
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { Button, Divider, Input } from "@mui/joy";
|
||||
import { Button, Checkbox, Divider, Input } from "@mui/joy";
|
||||
import { useEffect, useState } from "react";
|
||||
import { toast } from "react-hot-toast";
|
||||
import { Link } from "react-router-dom";
|
||||
@ -19,6 +19,7 @@ const SignIn = () => {
|
||||
const mode = systemStatus.profile.mode;
|
||||
const [username, setUsername] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
const [remember, setRemember] = useState(true);
|
||||
const disablePasswordLogin = systemStatus.disablePasswordLogin;
|
||||
const [identityProviderList, setIdentityProviderList] = useState<IdentityProvider[]>([]);
|
||||
|
||||
@ -71,7 +72,7 @@ const SignIn = () => {
|
||||
|
||||
try {
|
||||
actionBtnLoadingState.setLoading();
|
||||
await api.signin(username, password);
|
||||
await api.signin(username, password, remember);
|
||||
const user = await userStore.doSignIn();
|
||||
if (user) {
|
||||
window.location.href = "/";
|
||||
@ -138,6 +139,9 @@ const SignIn = () => {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-row justify-start items-center w-full mt-6">
|
||||
<Checkbox label={t("common.remember-me")} checked={remember} onChange={(e) => setRemember(e.target.checked)} />
|
||||
</div>
|
||||
<div className="flex flex-row justify-end items-center w-full mt-6">
|
||||
<Button
|
||||
className="w-full"
|
||||
|
Reference in New Issue
Block a user