Skip to content

Commit b755ddb

Browse files
TRAPWLS-19 username/password authentication setup is completed
1 parent 48297de commit b755ddb

File tree

8 files changed

+250
-80
lines changed

8 files changed

+250
-80
lines changed

src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function App() {
3232
<Routes>
3333
{isLoggedinUser === true ? (
3434
<>
35-
<Route path="/" element={<LoginPage/>}/>
35+
<Route path="/" element={<Home/>}/>
3636
<Route path="/home" element={<Home/>}/>
3737
<Route path="/dashboard" element={<Dashboard/>}/>
3838
<Route path="/issuecreate" element={<IssueCreationPage/>}/>

src/homePage/HeaderNavbarLogin.jsx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,38 @@
11
import React, { useEffect, useState } from 'react'
22
import { Link, NavLink, useNavigate } from 'react-router-dom'
33
import "../App.css"
4-
import { auth } from "../loginAuthentication/FirebaseConfig";
4+
import { auth } from '../loginAuthentication/firebase/FirebaseConfig';
55
import { signOut } from "firebase/auth";
6+
// import { useAuth } from "./../loginAuthentication/firebase/FirebaseAuth"
67

78
// SampleProfileUrl - https://images.pexels.com/photos/1742370/pexels-photo-1742370.jpeg?auto=compress&cs=tinysrgb&dpr=2&w=500
89
const HeaderNavbarLogin = (props) => {
910
const [menuOpen, setMenuOpen] = useState(false);
1011
const navigateToNextPage = useNavigate();
1112
const {isLoggedinUser, setLoggedInUser} = props;
13+
// const useAuthData = useAuth();
1214

1315

14-
function logoutOnclick() {
15-
signOut(auth).then(() => {
16-
localStorage.removeItem("loggedInData");
17-
setLoggedInUser(false)
18-
navigateToNextPage("/")
19-
}).catch((e) => {
20-
console.error("Sign out error-->",e)
21-
})
16+
function logoutOnclick(isClick = false) {
17+
isClick = true
18+
if(isClick) {
19+
auth.signOut();
20+
} else {
21+
signOut(auth).then(() => {
22+
console.log("GLogin Successfully loggedOut")
23+
}).catch((e) => {
24+
console.error("Sign out error-->",e)
25+
})
26+
}
2227

28+
localStorage.removeItem("loggedInData");
29+
setLoggedInUser(false);
30+
navigateToNextPage("/");
31+
return;
2332
}
2433

2534
useEffect(() => {
35+
// console.log("header screen--useAuthData--",useAuthData)
2636
const checkScreenSize = () => {
2737
if (window.innerWidth > 480) {
2838
setMenuOpen(false)

src/loginAuthentication/LoginPage.css

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
align-items: center;
1313
}
1414

15+
/* Styling for alternate type Login*/
1516
.cover{
1617
background-color: aqua;
1718
width: 30em;
@@ -59,6 +60,7 @@
5960

6061
}
6162

63+
/* Styling for input type Login*/
6264
.input {
6365
border: none;
6466
background-color: rgb(229, 226, 226);
@@ -75,11 +77,40 @@ input:focus{
7577
outline-color: rgb(32, 177, 255);
7678
}
7779

78-
.error2 {
79-
margin-left: -150px;
80+
.password-dialog {
81+
position: absolute;
82+
top: 40%;
83+
left: 100%;
84+
margin-left: 10px;
85+
width: 20em;
86+
padding: 1em;
87+
background-color: rgb(250, 250, 250);
88+
border: 1px solid #ccc;
89+
border-radius: 0.5em;
90+
font-size: medium;
91+
color: #333;
92+
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
93+
}
94+
95+
.password-dialog p {
96+
font-weight: bold;
97+
margin: 0 0 0.5em 0;
98+
}
99+
100+
.password-dialog ul {
101+
list-style: none;
102+
padding: 0;
103+
}
104+
105+
.password-dialog li, h3 {
106+
margin-left: 0.5em;
107+
margin-bottom: 0.5em;
108+
}
109+
110+
.error1, .error2 {
111+
margin-left: -130px !important;
80112
margin-bottom: -20px;
81113
color: red;
82-
align-items: start;
83114
}
84115

85116
.nav-registerlogin-btn{

0 commit comments

Comments
 (0)