Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remember me auto checks while login #1186

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions frontend/src/forms/LoginForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,24 @@ import useLanguage from '@/locale/useLanguage';
import { useSelector } from 'react-redux';
import { selectLangDirection } from '@/redux/translate/selectors';

export default function LoginForm() {
const langDirection = useSelector(selectLangDirection)
export default function LoginForm({ form }) {
const langDirection = useSelector(selectLangDirection);

const translate = useLanguage();
return (
<div style={{direction:langDirection}}>
<div style={{ direction: langDirection }}>
<Form.Item
label={translate('email')}
name="email"
rules={[
{
required: true,

},
{
type: 'email',
},
]}

>
>
<Input
prefix={<UserOutlined className="site-form-item-icon" />}
placeholder={translate('email')}
Expand All @@ -48,15 +46,18 @@ export default function LoginForm() {
size="large"
/>
</Form.Item>

<Form.Item>
<Form.Item name="remember" valuePropName="checked" noStyle>
<Checkbox>{translate('Remember me')}</Checkbox>
</Form.Item>
<a className="login-form-forgot" href="/forgetpassword" style={{marginLeft:langDirection==="rtl"?"220px":"0px"}}>
<a
className="login-form-forgot"
href="/forgetpassword"
style={{ marginLeft: langDirection === 'rtl' ? '220px' : '0px' }}
>
{translate('Forgot password')}
</a>

</Form.Item>
</div>
);
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/pages/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const LoginPage = () => {
const translate = useLanguage();
const { isLoading, isSuccess } = useSelector(selectAuth);
const navigate = useNavigate();
const [form] = Form.useForm();
// const size = useSize();

const dispatch = useDispatch();
Expand All @@ -32,6 +33,7 @@ const LoginPage = () => {
return (
<Loading isLoading={isLoading}>
<Form
form={form}
layout="vertical"
name="normal_login"
className="login-form"
Expand All @@ -40,7 +42,7 @@ const LoginPage = () => {
}}
onFinish={onFinish}
>
<LoginForm />
<LoginForm form={form} />
<Form.Item>
<Button
type="primary"
Expand Down
Loading