Loading portal-gui/src/app/(auth)/login/LoginForm.tsx +19 −4 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ import { PasswordStrengthMeter, } from "rsuite"; import buttons from "@/app/styles/buttons.module.scss"; import { useRouter } from "next/navigation"; type FormData = { username: string; password: string; Loading @@ -25,14 +27,26 @@ const initialFormData: FormData = { }; const LoginForm = () => { const router = useRouter(); const [formData, setFormData] = React.useState(initialFormData); const [error, setError] = React.useState(""); const onChange = <K extends keyof FormData>(key: K, value: FormData[K]) => { setFormData((prev) => ({ ...prev, [key]: value })); }; const handleLogin = () => { if (formData.username === "oop" && formData.password === "oop") { document.cookie = "auth=1; path=/"; router.push("/"); } else { setError("Invalid username or password."); } }; return ( <Form className={styles.form}> <h6>Welcome Back! Please login to your account.</h6> <h6>Welcome! Please login to your account.</h6> <CustomInputGroupWithDecoration name="username" label="Username" Loading @@ -52,14 +66,15 @@ const LoginForm = () => { } /> </Form.Group>{" "} <div className={styles.subBox}> {error && <p className={styles.error}>{error}</p>} {/* <div className={styles.subBox}> <Checkbox>Remember me</Checkbox> <Link href="#" className={styles.forgotLink}> Forgot your password? </Link> </div> </div> */} <div className={styles.btnBox}> <Button className={buttons.primary} href="/">Login</Button> <Button className={buttons.primary} onClick={handleLogin}>Login</Button> </div> </Form> ); Loading portal-gui/src/app/(auth)/login/login.module.scss +6 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,12 @@ gap: 0.5rem; } .error { color: #e03a3a; font-size: 0.8rem; margin: 0; } .forgotLink { color: var(--blue-color); font-size: 0.7rem; Loading portal-gui/src/app/(auth)/login/page.tsx +3 −3 Original line number Diff line number Diff line Loading @@ -23,12 +23,12 @@ const LoginPage = () => { priority className={styles.bg} /> <SegmentedControl {/* <SegmentedControl data={loginTabs} defaultValue="login" onChange={(val) => setActiveTab(val as LoginTabKey)} block /> /> */} <div className={styles.box}> Loading @@ -36,7 +36,7 @@ const LoginPage = () => { {activeTab === "login" && <LoginForm />} {/* ---------- REGISTER TAB ---------- */} {activeTab === "register" && <RegisterForm />} {/* {activeTab === "register" && <RegisterForm />} */} </div> </div> ); Loading portal-gui/src/app/components/TopBar/TopBar.tsx +7 −4 Original line number Diff line number Diff line Loading @@ -48,18 +48,21 @@ const TopBar = () => { icon={userIcon} title={ <span className={styles.username}> {formatName(user.name)} {user.name} </span> } placement="bottomEnd" > <Nav.Item as={Link} href="/profile"> {/* <Nav.Item as={Link} href="/profile"> Profile </Nav.Item> <Nav.Item as={Link} href="/settings"> Settings </Nav.Item> <Nav.Item onClick={() => router.push("/logout")}> </Nav.Item> */} <Nav.Item onClick={() => { document.cookie = "auth=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/"; router.push("/login"); }}> Log Out </Nav.Item> </Nav.Menu> Loading portal-gui/src/app/utils/constants.ts +3 −3 Original line number Diff line number Diff line Loading @@ -21,10 +21,10 @@ export const loginTabs: { label: string; value: LoginTabKey }[] = [ ]; export const user = { name: "Chnarakis Panagiotis", name: "OOP Developer", role: "Developer", email: "pchnarakis@intracom-telecom.com", organization: "Intracom Telecom", email: "developer@example.com", organization: "OOP", }; export const oeg = { jsonUrl: "http://localhost:32263/oeg/1.0.0/openapi.json" Loading Loading
portal-gui/src/app/(auth)/login/LoginForm.tsx +19 −4 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ import { PasswordStrengthMeter, } from "rsuite"; import buttons from "@/app/styles/buttons.module.scss"; import { useRouter } from "next/navigation"; type FormData = { username: string; password: string; Loading @@ -25,14 +27,26 @@ const initialFormData: FormData = { }; const LoginForm = () => { const router = useRouter(); const [formData, setFormData] = React.useState(initialFormData); const [error, setError] = React.useState(""); const onChange = <K extends keyof FormData>(key: K, value: FormData[K]) => { setFormData((prev) => ({ ...prev, [key]: value })); }; const handleLogin = () => { if (formData.username === "oop" && formData.password === "oop") { document.cookie = "auth=1; path=/"; router.push("/"); } else { setError("Invalid username or password."); } }; return ( <Form className={styles.form}> <h6>Welcome Back! Please login to your account.</h6> <h6>Welcome! Please login to your account.</h6> <CustomInputGroupWithDecoration name="username" label="Username" Loading @@ -52,14 +66,15 @@ const LoginForm = () => { } /> </Form.Group>{" "} <div className={styles.subBox}> {error && <p className={styles.error}>{error}</p>} {/* <div className={styles.subBox}> <Checkbox>Remember me</Checkbox> <Link href="#" className={styles.forgotLink}> Forgot your password? </Link> </div> </div> */} <div className={styles.btnBox}> <Button className={buttons.primary} href="/">Login</Button> <Button className={buttons.primary} onClick={handleLogin}>Login</Button> </div> </Form> ); Loading
portal-gui/src/app/(auth)/login/login.module.scss +6 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,12 @@ gap: 0.5rem; } .error { color: #e03a3a; font-size: 0.8rem; margin: 0; } .forgotLink { color: var(--blue-color); font-size: 0.7rem; Loading
portal-gui/src/app/(auth)/login/page.tsx +3 −3 Original line number Diff line number Diff line Loading @@ -23,12 +23,12 @@ const LoginPage = () => { priority className={styles.bg} /> <SegmentedControl {/* <SegmentedControl data={loginTabs} defaultValue="login" onChange={(val) => setActiveTab(val as LoginTabKey)} block /> /> */} <div className={styles.box}> Loading @@ -36,7 +36,7 @@ const LoginPage = () => { {activeTab === "login" && <LoginForm />} {/* ---------- REGISTER TAB ---------- */} {activeTab === "register" && <RegisterForm />} {/* {activeTab === "register" && <RegisterForm />} */} </div> </div> ); Loading
portal-gui/src/app/components/TopBar/TopBar.tsx +7 −4 Original line number Diff line number Diff line Loading @@ -48,18 +48,21 @@ const TopBar = () => { icon={userIcon} title={ <span className={styles.username}> {formatName(user.name)} {user.name} </span> } placement="bottomEnd" > <Nav.Item as={Link} href="/profile"> {/* <Nav.Item as={Link} href="/profile"> Profile </Nav.Item> <Nav.Item as={Link} href="/settings"> Settings </Nav.Item> <Nav.Item onClick={() => router.push("/logout")}> </Nav.Item> */} <Nav.Item onClick={() => { document.cookie = "auth=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/"; router.push("/login"); }}> Log Out </Nav.Item> </Nav.Menu> Loading
portal-gui/src/app/utils/constants.ts +3 −3 Original line number Diff line number Diff line Loading @@ -21,10 +21,10 @@ export const loginTabs: { label: string; value: LoginTabKey }[] = [ ]; export const user = { name: "Chnarakis Panagiotis", name: "OOP Developer", role: "Developer", email: "pchnarakis@intracom-telecom.com", organization: "Intracom Telecom", email: "developer@example.com", organization: "OOP", }; export const oeg = { jsonUrl: "http://localhost:32263/oeg/1.0.0/openapi.json" Loading