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

solver issue #1136 for frontend part #1137

Open
wants to merge 1 commit into
base: master
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
2 changes: 1 addition & 1 deletion backend/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#DATABASE = "mongodb://localhost:27017"
DATABASE = "mongodb+srv://sribabu:[email protected]/?retryWrites=true&w=majority"
#RESEND_API = "your resend_api"
#OPENAI_API_KEY = "your open_ai api key"
JWT_SECRET= "your_private_jwt_secret_key"
Expand Down
4 changes: 2 additions & 2 deletions backend/package-lock.json

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

10 changes: 5 additions & 5 deletions frontend/package-lock.json

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

10 changes: 10 additions & 0 deletions frontend/src/pages/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import { selectAuth } from '@/redux/auth/selectors';
import LoginForm from '@/forms/LoginForm';
import Loading from '@/components/Loading';
import AuthModule from '@/modules/AuthModule';
import RegisterForm from '@/forms/RegisterForm';

import { Typography } from 'antd';

const { Text } = Typography;

const LoginPage = () => {
const translate = useLanguage();
Expand Down Expand Up @@ -51,6 +56,11 @@ const LoginPage = () => {
>
{translate('Log in')}
</Button>
<Text style={{ color: 'grey',cursor:"pointer" }}>
Don't have an account? <Text strong style={{ color: 'black' ,cursor:"pointer"}} onClick={() => {
navigate("/register")
}} className="hover-underline">Register</Text>
</Text>
</Form.Item>
</Form>
</Loading>
Expand Down
73 changes: 73 additions & 0 deletions frontend/src/pages/Register.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { useEffect } from 'react';

import { useDispatch, useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom';

import useLanguage from '@/locale/useLanguage';

import { Form, Button } from 'antd';

import { login } from '@/redux/auth/actions';
import { selectAuth } from '@/redux/auth/selectors';
// import LoginForm from '@/forms/LoginForm';
import RegisterForm from '@/forms/RegisterForm';
import Loading from '@/components/Loading';
import AuthModule from '@/modules/AuthModule';
import { Typography } from 'antd';

const { Text } = Typography;


const RegisterPage = () => {
const translate = useLanguage();
const { isLoading, isSuccess } = useSelector(selectAuth);
const navigate = useNavigate();
// const size = useSize();

const dispatch = useDispatch();
const onFinish = (values) => {
dispatch(login({ loginData: values }));
};

useEffect(() => {
if (isSuccess) navigate('/');
}, [isSuccess]);

const FormContainer = () => {
return (
<Loading isLoading={isLoading}>
<Form
layout="vertical"
name="normal_login"
className="login-form"
initialValues={{
remember: true,
}}
onFinish={onFinish}
>
<RegisterForm />
<Form.Item>
<Button
type="primary"
htmlType="submit"
className="login-form-button"
loading={isLoading}
size="large"
>
{translate('Register')}
</Button>
<Text style={{ color: 'grey' }}>
Already have an account? <Text strong style={{ color: 'black',cursor:"pointer" }} onClick={() => {
navigate("/")
}} className="hover-underline">Login</Text>
</Text>
</Form.Item>
</Form>
</Loading>
);
};

return <AuthModule authContent={<FormContainer />} AUTH_TITLE="Sign in" />;
};

export default RegisterPage;
2 changes: 2 additions & 0 deletions frontend/src/router/AuthRouter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import NotFound from '@/pages/NotFound';

import ForgetPassword from '@/pages/ForgetPassword';
import ResetPassword from '@/pages/ResetPassword';
import RegisterPage from '@/pages/Register';

import { useDispatch } from 'react-redux';

Expand All @@ -15,6 +16,7 @@ export default function AuthRouter() {
<Routes>
<Route element={<Login />} path="/" />
<Route element={<Login />} path="/login" />
<Route element={<RegisterPage />} path="/register" />
<Route element={<Navigate to="/login" replace />} path="/logout" />
<Route element={<ForgetPassword />} path="/forgetpassword" />
<Route element={<ResetPassword />} path="/resetpassword/:userId/:resetToken" />
Expand Down