diff --git a/src/pages/authentication/RegisterCustom.js b/src/pages/authentication/RegisterCustom.js
index b64074e..33d236f 100644
--- a/src/pages/authentication/RegisterCustom.js
+++ b/src/pages/authentication/RegisterCustom.js
@@ -9,7 +9,7 @@ import Typography from '@mui/material/Typography';
import iAmSmartICon from 'assets/images/icons/icon_iAmSmart.png';
import banner from 'assets/images/bg_ml.jpg';
import { Stack } from '../../../node_modules/@mui/material/index';
-import { iAmSmartPath, iAmSmartAppPath, clientId, getBowserType, isAppBowser, iAmSmartCallbackPath} from 'auth/utils'
+import { iAmSmartPath, clientId, getBowserType, isAppBowser, iAmSmartCallbackPath} from 'auth/utils'
import * as React from 'react';
import {FormattedMessage, useIntl} from "react-intl";
@@ -48,20 +48,17 @@ const RegisterCustom = () => {
}
const openApp = () => {
- setTimeout(function () {
- openQR();
- }, 1000);
- let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/registrycallback";
- let url = iAmSmartAppPath + "auth"
+ let callbackUrl = "https://"+iAmSmartCallbackPath()+"/iamsmart/registrycallback";
+ let url = iAmSmartPath + "/api/v1/auth/getQR"
+ "?clientID=" + clientId
+ "&responseType=code"
- + "&source=" + getBowserType()
- + "&redirectURI=" + encodeURIComponent(callbackUrl)
- + "&scope=" + encodeURIComponent("eidapi_auth eidapi_profiles")
- + "&lang=zh-HK"//en-US, zh-HK, or zh-CN
+ +"&source=" + getBowserType()
+ +"&redirectURI="+encodeURIComponent(callbackUrl)
+ +"&scope="+encodeURIComponent("eidapi_auth eidapi_profiles")
+ +"&lang=zh-HK"//en-US, zh-HK, or zh-CN
//+"&state="
- + "&brokerPage=false"
- window.location=url;
+ +"&brokerPage=true"
+ window.location.assign(url);
}
return (
diff --git a/src/pages/authentication/auth-forms/AuthLoginCustom.js b/src/pages/authentication/auth-forms/AuthLoginCustom.js
index d331698..0784c6a 100644
--- a/src/pages/authentication/auth-forms/AuthLoginCustom.js
+++ b/src/pages/authentication/auth-forms/AuthLoginCustom.js
@@ -6,7 +6,8 @@ import React, {
import { Link as RouterLink } from 'react-router-dom';
import { useNavigate } from 'react-router-dom';
import { useForm, } from 'react-hook-form'
-import { iAmSmartPath, iAmSmartAppPath, clientId, getBowserType, isAppBowser, iAmSmartCallbackPath } from 'auth/utils'
+import { iAmSmartPath, clientId, getBowserType, isAppBowser, iAmSmartCallbackPath } from 'auth/utils'
+//iAmSmartAppPath
// material-ui
import {
@@ -196,8 +197,23 @@ const AuthLoginCustom = () => {
// setTimeout(function () {
// openQR();
// }, 1000);
+ // let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/authcallback";
+
+ // let source = getBowserType()
+ // console.log(source)
+ // let url = iAmSmartAppPath + "auth"
+ // + "?clientID=" + clientId
+ // + "&responseType=code"
+ // + "&source=" + getBowserType()
+ // + "&redirectURI=" + encodeURIComponent(callbackUrl)
+ // + "&scope=" + encodeURIComponent("eidapi_auth eidapi_profiles")
+ // + "&lang=zh-HK"//en-US, zh-HK, or zh-CN
+ // //+"&state="
+ // + "&brokerPage=true"
+ // window.location=url;
+
let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/authcallback";
- let url = iAmSmartAppPath + "auth"
+ let url = iAmSmartPath + "/api/v1/auth/getQR"
+ "?clientID=" + clientId
+ "&responseType=code"
+ "&source=" + getBowserType()
@@ -205,8 +221,9 @@ const AuthLoginCustom = () => {
+ "&scope=" + encodeURIComponent("eidapi_auth eidapi_profiles")
+ "&lang=zh-HK"//en-US, zh-HK, or zh-CN
//+"&state="
- + "&brokerPage=false"
- window.location=url;
+ + "&brokerPage=true"
+ window.location=url;
+
}
diff --git a/src/pages/iAmSmart/DirectLoginCallback/index.js b/src/pages/iAmSmart/DirectLoginCallback/index.js
index a87236a..89208b8 100644
--- a/src/pages/iAmSmart/DirectLoginCallback/index.js
+++ b/src/pages/iAmSmart/DirectLoginCallback/index.js
@@ -27,7 +27,7 @@ const Index = () => {
let params = new URLSearchParams(window.location.search)
if(params.get("code")){
HttpUtils.post({
- url: UrlUtils.GET_SMART_LOGIN,
+ url: UrlUtils.GET_SMART_DIRECT_LOGIN,
params:{
code: params.get("code")
},
diff --git a/src/pages/iAmSmart/FallCallback/index.js b/src/pages/iAmSmart/FallCallback/index.js
deleted file mode 100644
index 7716ad5..0000000
--- a/src/pages/iAmSmart/FallCallback/index.js
+++ /dev/null
@@ -1,72 +0,0 @@
-
-import * as React from "react";
-import * as HttpUtils from "utils/HttpUtils";
-import * as UrlUtils from "utils/ApiPathConst";
-import { useNavigate } from "react-router-dom";
-import { useDispatch } from "react-redux";
-import { handleLogoutFunction, handleLogin } from 'auth/index';
-
-import Loadable from 'components/Loadable';
-const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent')));
-
-
-// ==============================|| DASHBOARD - DEFAULT ||============================== //
-
-const Index = () => {
-
- const dispatch = useDispatch()
- const navigate = useNavigate()
-
- React.useEffect(() => {
- getPrfile();
- }, []);
-
- function getPrfile(){
- dispatch(handleLogoutFunction());
-
- let params = new URLSearchParams(window.location.search)
- if(params.get("code")){
- HttpUtils.post({
- url: UrlUtils.GET_SMART_LOGIN,
- params:{
- code: params.get("code")
- },
- onSuccess: (responseData) => {
-
- //navigate('/iAmSmartRegisterFrom', { state: { responseData: responseData } });
-
- console.log(response)
- const userData = {
- id: responseData.id,
- fullenName: responseData.name,
- fullchName: responseData.chName,
- email: responseData.email,
- type: responseData.type,
- role: responseData.role,
- abilities: responseData.abilities,
- creditor: responseData.creditor,
- //avatar: require('src/assets/images/users/avatar-3.png').default,
- }
- const data = { ...userData, accessToken: responseData.accessToken, refreshToken: responseData.refreshToken }
- // setSuccess(true)
- dispatch(handleLogin(data))
- navigate('/dashboard');
- location.reload()
-
- },
- onFail: ()=>{
- window.location.assign("/login");
- },
- onError:()=>{
- window.location.assign("/login");
- }
- });
- }
- }
-
- return (
-
- );
-};
-
-export default Index;
\ No newline at end of file
diff --git a/src/routes/LoginRoutes.js b/src/routes/LoginRoutes.js
index 04f4dc6..b3c7533 100644
--- a/src/routes/LoginRoutes.js
+++ b/src/routes/LoginRoutes.js
@@ -12,7 +12,7 @@ const RegisterForm = Loadable(lazy(() => import('pages/authentication/Register')
const BusRegisterForm = Loadable(lazy(() => import('pages/authentication/BusRegister')));
const IAmSmartRegister = Loadable(lazy(() => import('pages/authentication/IAmSmartRegister')));
const ErrorPage = Loadable(lazy(() => import('pages/extra-pages/ErrorPage')));
-//const IAmSmart_DirectLoginCallback = Loadable(lazy(() => import('pages/iAmSmart/DirectLoginCallback')));
+const IAmSmart_DirectLoginCallback = Loadable(lazy(() => import('pages/iAmSmart/DirectLoginCallback')));
//const IAmSmart_FallCallback = Loadable(lazy(() => import('pages/iAmSmart/FallCallback')));
const IAmSmart_FailCallback = Loadable(lazy(() => import('pages/iAmSmart/FailCallback')));
const IAmSmart_SuccessCallback = Loadable(lazy(() => import('pages/iAmSmart/SuccessCallback')));
@@ -61,7 +61,7 @@ const LoginRoutes = {
},
{
path: 'iamsmart/logincallback',
- element:
+ element:
},
{
path: 'iamsmart/loginfallback',
diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js
index 316270e..77fd0e6 100644
--- a/src/utils/ApiPathConst.js
+++ b/src/utils/ApiPathConst.js
@@ -124,6 +124,7 @@ export const DELETE_EMAIL = apiPath+'/email/delete';
//iAmSmart
export const GET_SMART_PROFILE = apiPath+'/smart/getProfile'; //POST
export const GET_SMART_LOGIN = apiPath+'/smart/login'; //POST
+export const GET_SMART_DIRECT_LOGIN = apiPath+'/smart/directLogin'; //POST
//gen report