@@ -19,7 +19,7 @@ import Alert from "../primitives/Alert";
19
19
import { appInfo } from "../constant/appinfo" ;
20
20
import { fetchAppInfo } from "../redux/reducers/infoReducer" ;
21
21
import { showTenant } from "../redux/reducers/ShowTenant" ;
22
- import { fetchSubscription , getAppLogo } from "../constant/Utils" ;
22
+ import { fetchSubscription , getAppLogo , openInNewTab } from "../constant/Utils" ;
23
23
function Login ( ) {
24
24
const navigate = useNavigate ( ) ;
25
25
const location = useLocation ( ) ;
@@ -1016,8 +1016,9 @@ function Login() {
1016
1016
1017
1017
const handleCloseModal = ( ) => {
1018
1018
setIsModal ( false ) ;
1019
- Parse . User . logOut ( ) ;
1020
-
1019
+ if ( Parse ?. User ?. current ( ) ) {
1020
+ Parse . User . logOut ( ) ;
1021
+ }
1021
1022
let appdata = localStorage . getItem ( "userSettings" ) ;
1022
1023
let applogo = localStorage . getItem ( "appLogo" ) ;
1023
1024
let appName = localStorage . getItem ( "appName" ) ;
@@ -1040,6 +1041,15 @@ function Login() {
1040
1041
localStorage . setItem ( "baseUrl" , baseUrl ) ;
1041
1042
localStorage . setItem ( "parseAppId" , appid ) ;
1042
1043
} ;
1044
+ const handleSignInWithSSO = ( ) => {
1045
+ if ( state ?. email ) {
1046
+ openInNewTab (
1047
+ `https://osl-jacksonv2.vercel.app/api/oauth/authorize?response_type=code&provider=saml&tenant=Okta-dev-nxglabs-in&product=OpenSign&redirect_uri=http://localhost:3000/sso&state=${ state . email } `
1048
+ ) ;
1049
+ } else {
1050
+ alert ( "Please provide email." ) ;
1051
+ }
1052
+ } ;
1043
1053
return (
1044
1054
< div className = "bg-white" >
1045
1055
< Title title = { "Login Page" } />
@@ -1087,136 +1097,123 @@ function Login() {
1087
1097
</ div >
1088
1098
< div className = "grid grid-cols-1 md:grid-cols-2 gap-x-2" >
1089
1099
< div >
1090
- < div >
1091
- < form onSubmit = { handleSubmit } aria-label = "Login Form" >
1092
- < h1 className = "text-[30px] mt-6" > Welcome Back!</ h1 >
1093
- < fieldset >
1094
- < legend className = "text-[12px] text-[#878787]" >
1095
- Login to your account
1096
- </ legend >
1097
- < div className = "px-6 py-4 outline outline-1 outline-slate-300/50 my-2 rounded shadow-md" >
1098
- < label className = "block text-xs" htmlFor = "email" >
1099
- Username
1100
- </ label >
1100
+ < form onSubmit = { handleSubmit } aria-label = "Login Form" >
1101
+ < h1 className = "text-[30px] mt-6" > Welcome Back!</ h1 >
1102
+ < fieldset >
1103
+ < legend className = "text-[12px] text-[#878787]" >
1104
+ Login to your account
1105
+ </ legend >
1106
+ < div className = "px-6 py-4 outline outline-1 outline-slate-300/50 my-2 rounded shadow-md" >
1107
+ < label className = "block text-xs" htmlFor = "email" >
1108
+ Email
1109
+ </ label >
1110
+ < input
1111
+ id = "email"
1112
+ type = "text"
1113
+ className = "px-3 py-2 w-full border-[1px] border-gray-300 rounded text-xs"
1114
+ name = "email"
1115
+ value = { state . email }
1116
+ onChange = { handleChange }
1117
+ required
1118
+ />
1119
+ < hr className = "my-2 border-none" />
1120
+ < label className = "block text-xs" htmlFor = "password" >
1121
+ Password
1122
+ </ label >
1123
+ < div className = "relative" >
1101
1124
< input
1102
- id = "email "
1103
- type = "text"
1125
+ id = "password "
1126
+ type = { state . passwordVisible ? "text" : "password" }
1104
1127
className = "px-3 py-2 w-full border-[1px] border-gray-300 rounded text-xs"
1105
- name = "email "
1106
- value = { state . email }
1128
+ name = "password "
1129
+ value = { state . password }
1107
1130
onChange = { handleChange }
1108
1131
required
1109
1132
/>
1110
- < hr className = "my-2 border-none" />
1111
- < label className = "block text-xs" htmlFor = "password" >
1112
- Password
1113
- </ label >
1114
- < div className = "relative" >
1115
- < input
1116
- id = "password"
1117
- type = { state . passwordVisible ? "text" : "password" }
1118
- className = "px-3 py-2 w-full border-[1px] border-gray-300 rounded text-xs"
1119
- name = "password"
1120
- value = { state . password }
1121
- onChange = { handleChange }
1122
- required
1123
- />
1124
- < span
1125
- className = { `absolute top-[50%] right-[10px] -translate-y-[50%] cursor-pointer ${
1126
- state . passwordVisible
1127
- ? "text-[#007bff]"
1128
- : "text-black"
1129
- } `}
1130
- onClick = { togglePasswordVisibility }
1131
- >
1132
- { state . passwordVisible ? (
1133
- < i className = "fa fa-eye-slash text-xs pb-1" /> // Close eye icon
1134
- ) : (
1135
- < i className = "fa fa-eye text-xs pb-1 " /> // Open eye icon
1136
- ) }
1137
- </ span >
1138
- </ div >
1139
- < div className = "relative mt-1" >
1140
- < NavLink
1141
- to = "/forgetpassword"
1142
- className = "text-[13px] text-[#002864] hover:underline underline-offset-1 focus:outline-none cursor-pointer ml-1"
1143
- >
1144
- Forgot Password?
1145
- </ NavLink >
1146
- </ div >
1133
+ < span
1134
+ className = { `absolute top-[50%] right-[10px] -translate-y-[50%] cursor-pointer ${
1135
+ state . passwordVisible
1136
+ ? "text-[#007bff]"
1137
+ : "text-black"
1138
+ } `}
1139
+ onClick = { togglePasswordVisibility }
1140
+ >
1141
+ { state . passwordVisible ? (
1142
+ < i className = "fa fa-eye-slash text-xs pb-1" /> // Close eye icon
1143
+ ) : (
1144
+ < i className = "fa fa-eye text-xs pb-1 " /> // Open eye icon
1145
+ ) }
1146
+ </ span >
1147
+ </ div >
1148
+ < div className = "relative mt-1" >
1149
+ < NavLink
1150
+ to = "/forgetpassword"
1151
+ className = "text-[13px] text-[#002864] hover:underline underline-offset-1 focus:outline-none cursor-pointer ml-1"
1152
+ >
1153
+ Forgot Password?
1154
+ </ NavLink >
1147
1155
</ div >
1148
- </ fieldset >
1149
- < div className = "flex flex-col md:flex-row justify-between items-stretch gap-8 text-center text-xs font-bold mt-2" >
1150
- < button
1151
- type = "submit"
1152
- className = "rounded-sm bg-[#3ac9d6] text-white w-full py-3 shadow outline-none uppercase focus:ring-2 focus:ring-blue-600"
1153
- disabled = { state . loading }
1154
- >
1155
- { state . loading ? "Loading..." : "Login" }
1156
- </ button >
1157
- < NavLink
1158
- className = "rounded-sm cursor-pointer bg-white border-[1px] border-[#15b4e9] text-[#15b4e9] w-full py-3 shadow uppercase"
1159
- to = {
1160
- location . search
1161
- ? "/signup" + location . search
1162
- : "/signup"
1163
- }
1164
- style = { width < 768 ? { textAlign : "center" } : { } }
1165
- >
1166
- Create Account
1167
- </ NavLink >
1168
- </ div >
1169
- </ form >
1170
- < br />
1171
- { ( appInfo . fbAppId || appInfo . googleClietId ) && (
1172
- < div className = "text-sm flex justify-center items-center" >
1173
- < hr className = "border-[1px] border-gray-300 w-full" />
1174
- < span className = "px-2 text-gray-500 cursor-default" >
1175
- OR
1176
- </ span >
1177
- < hr className = "border-[1px] border-gray-300 w-full" />
1178
1156
</ div >
1179
- ) }
1180
- < br />
1181
- < div
1182
- style = { {
1183
- textAlign : "center" ,
1184
- display : "flex" ,
1185
- alignItems : "center" ,
1186
- justifyContent : "center"
1187
- } }
1188
- >
1189
- { /* {appInfo.fbAppId && appInfo.fbAppId !== "" ? (
1157
+ </ fieldset >
1158
+ < div className = "flex flex-col md:flex-row justify-between items-stretch gap-8 text-center text-xs font-bold mt-2" >
1159
+ < button
1160
+ type = "submit"
1161
+ className = "rounded-sm bg-[#3ac9d6] text-white w-full py-3 shadow outline-none uppercase focus:ring-2 focus:ring-blue-600"
1162
+ disabled = { state . loading }
1163
+ >
1164
+ { state . loading ? "Loading..." : "Login" }
1165
+ </ button >
1166
+ < NavLink
1167
+ className = "rounded-sm cursor-pointer bg-white border-[1px] border-[#15b4e9] text-[#15b4e9] w-full py-3 shadow uppercase"
1168
+ to = {
1169
+ location . search
1170
+ ? "/signup" + location . search
1171
+ : "/signup"
1172
+ }
1173
+ style = { width < 768 ? { textAlign : "center" } : { } }
1174
+ >
1175
+ Create Account
1176
+ </ NavLink >
1177
+ </ div >
1178
+ </ form >
1179
+ < br />
1180
+ { appInfo . googleClietId && (
1181
+ < div className = "text-sm flex justify-center items-center" >
1182
+ < hr className = "border-[1px] border-gray-300 w-full" />
1183
+ < span className = "px-2 text-gray-500 cursor-default" >
1184
+ OR
1185
+ </ span >
1186
+ < hr className = "border-[1px] border-gray-300 w-full" />
1187
+ </ div >
1188
+ ) }
1189
+ < br />
1190
+ < div className = "flex flex-col justify-center items-center gap-y-3" >
1191
+ { /* {appInfo?.fbAppId && (
1190
1192
<LoginFacebook
1191
1193
FBCred={appInfo.fbAppId}
1192
1194
thirdpartyLoginfn={thirdpartyLoginfn}
1193
1195
thirdpartyLoader={state.thirdpartyLoader}
1194
1196
setThirdpartyLoader={setThirdpartyLoader}
1195
1197
/>
1196
- ) : null} */ }
1197
- </ div >
1198
- < div style = { { margin : "10px 0" } } > </ div >
1198
+ )} */ }
1199
+ { appInfo ?. googleClietId && (
1200
+ < GoogleSignInBtn
1201
+ GoogleCred = { appInfo . googleClietId }
1202
+ thirdpartyLoginfn = { thirdpartyLoginfn }
1203
+ thirdpartyLoader = { state . thirdpartyLoader }
1204
+ setThirdpartyLoader = { setThirdpartyLoader }
1205
+ />
1206
+ ) }
1199
1207
< div
1200
- style = { {
1201
- textAlign : "center" ,
1202
- display : "flex" ,
1203
- alignItems : "center" ,
1204
- justifyContent : "center"
1205
- } }
1208
+ className = "cursor-pointer border-[1px] border-gray-300 rounded px-[40px] py-2 font-semibold text-sm hover:border-[#d2e3fc] hover:bg-[#ecf3feb7]"
1209
+ onClick = { ( ) => handleSignInWithSSO ( ) }
1206
1210
>
1207
- { appInfo . googleClietId && appInfo . googleClietId !== "" ? (
1208
- < GoogleSignInBtn
1209
- GoogleCred = { appInfo . googleClietId }
1210
- thirdpartyLoginfn = { thirdpartyLoginfn }
1211
- thirdpartyLoader = { state . thirdpartyLoader }
1212
- setThirdpartyLoader = { setThirdpartyLoader }
1213
- />
1214
- ) : null }
1211
+ Sign in with SSO
1215
1212
</ div >
1216
1213
</ div >
1217
1214
</ div >
1218
1215
{ width >= 768 && (
1219
- < div className = "self-center" >
1216
+ < div className = "place- self-center" >
1220
1217
< div className = "mx-auto md:w-[300px] lg:w-[400px] xl:w-[500px]" >
1221
1218
< img
1222
1219
src = { login_img }
0 commit comments