Skip to content

Commit dc87e14

Browse files
BackendExpertJehanKandyAnupa1998
committed
Update
Co-Authored-By: JehanKandy <[email protected]> Co-Authored-By: Anupa Gamage <[email protected]>
1 parent 8e3accd commit dc87e14

File tree

2 files changed

+14
-42
lines changed

2 files changed

+14
-42
lines changed

LoginSignUp/SignIn.jsx

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,13 @@ const SignIn = () => {
2929
//store token in localstorage
3030
localStorage.setItem('LoginToken', loginToken)
3131

32-
if(res.data.Msg === "Success"){
33-
if(res.data.LoginUser[0].is_active === 0 && res.data.LoginUser[0].is_lock === 1){
34-
alert('Your Account has been locked. Unauthorized activity has been detected.')
35-
localStorage.clear()
36-
navigate('/')
37-
}
38-
else if(res.data.LoginUser[0].is_active === 0){
39-
alert('Your Account is still not Activate Wait for Activate from Admin')
40-
localStorage.clear()
41-
navigate('/')
42-
}
43-
else{
44-
//get and store login user role and email
45-
const userRole = res.data.LoginUser[0].role;
46-
const userEmail = res.data.LoginUser[0].email;
47-
48-
//store data in localstore so that use secureLocalStorage
49-
secureLocalStorage.setItem("Login1", userRole);
50-
secureLocalStorage.setItem("login2", userEmail);
51-
navigate('/Dashboard');
52-
}
32+
if(res.data.Status === "Success"){
33+
alert("Login Successfull")
34+
localStorage.setItem('token', res.data.Token)
35+
navigate('/Dashboard')
36+
// login user Email
37+
secureLocalStorage.setItem('Login1', res.data.Result.email)
38+
secureLocalStorage.setItem('Login2', res.data.Result.Role)
5339
}
5440
else{
5541
alert(res.data.Error)

LoginSignUpTW/SignIn.jsx

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,13 @@ const SignIn = () => {
2626
//store token in localstorage
2727
localStorage.setItem('LoginToken', loginToken)
2828

29-
if(res.data.Msg === "Success"){
30-
if(res.data.LoginUser[0].is_active === 0 && res.data.LoginUser[0].is_lock === 1){
31-
alert('Your Account has been locked. Unauthorized activity has been detected.')
32-
localStorage.clear()
33-
navigate('/')
34-
}
35-
else if(res.data.LoginUser[0].is_active === 0){
36-
alert('Your Account is still not Activate Wait for Activate from Admin')
37-
localStorage.clear()
38-
navigate('/')
39-
}
40-
else{
41-
//get and store login user role and email
42-
const userRole = res.data.LoginUser[0].role;
43-
const userEmail = res.data.LoginUser[0].email;
44-
45-
//store data in localstore so that use secureLocalStorage
46-
secureLocalStorage.setItem("Login1", userRole);
47-
secureLocalStorage.setItem("login2", userEmail);
48-
navigate('/Dashboard');
49-
}
29+
if(res.data.Status === "Success"){
30+
alert("Login Successfull")
31+
localStorage.setItem('token', res.data.Token)
32+
navigate('/Dashboard')
33+
// login user Email
34+
secureLocalStorage.setItem('Login1', res.data.Result.email)
35+
secureLocalStorage.setItem('Login2', res.data.Result.Role)
5036
}
5137
else{
5238
alert(res.data.Error)

0 commit comments

Comments
 (0)