浏览代码

Direct login

master
Anna Ho 1年前
父节点
当前提交
e79129051e
共有 2 个文件被更改,包括 22 次插入2 次删除
  1. +3
    -2
      src/pages/Payment/FPS/FPSTest.js
  2. +19
    -0
      src/pages/authentication/auth-forms/AuthLoginCustom.js

+ 3
- 2
src/pages/Payment/FPS/FPSTest.js 查看文件

@@ -45,7 +45,7 @@ const Index = () => {
const [fpsqrcodeurl, setFpsqrcodeurl] = React.useState("");
const [browserType, setBrowserType] = React.useState("");
const mobileBrowser = "Mobile";
// const desktopBrowser = "Desktop";
const desktopBrowser = "Desktop";
// const pasgPath = 'https://fps.payapps.hkicl.com.hk'; //PRD
// const pasgPath = 'https://sim.fps.payapps.hkicl.com.hk'; //Testing
// const loadPaymentUrl = "/api/payment/wallet/fps";
@@ -67,11 +67,12 @@ const Index = () => {
if (/Android|webOS|iPhone|iPad|iPod|Opera Mini/i.test(navigator.userAgent)) {
console.log('Mobile web browser');
setBrowserType(mobileBrowser)
setFpsqrcodeurl(openPASGUrl)
console.log(openPASGUrl)
// renderOpenFPSPaymentAppTemplate(openPASGUrl, $('#openFPSPaymentAppTemplate').html());
} else {
console.log('Desktop web browser');
setBrowserType(mobileBrowser)
setBrowserType(desktopBrowser)
const parsedUrl = new URL("http://127.0.0.1:8080/api/payment/wallet/fps/enquiryfpspayload/vm.JKDDlTOavR3ASviSwUnS1Lw4-");
console.log(parsedUrl)
const fpsqrcodeurl = parsedUrl.pathname;


+ 19
- 0
src/pages/authentication/auth-forms/AuthLoginCustom.js 查看文件

@@ -182,6 +182,20 @@ const AuthLoginCustom = () => {
window.location.assign(url);
}

const openApp = () => {
let callbackUrl = "https://"+iAmSmartCallbackPath()+"/iamsmart/authcallback";
let url = "hk.gov.iamsmart.testapp://" +"auth"
+ "?clientID=" + clientId
+ "&responseType=code"
+"&source=" + getBowerType()
+"&redirectURI="+encodeURIComponent(callbackUrl)
+"&scope="+encodeURIComponent("eidapi_auth eidapi_profiles")
+"&lang=zh-HK"//en-US, zh-HK, or zh-CN
//+"&state="
+"&brokerPage=false"
window.location.assign(url);
}


return (
<FormikProvider value={formik}>
@@ -280,6 +294,11 @@ const AuthLoginCustom = () => {
<Button onClick={()=>getQRWithIAmSmart()} color="iAmSmart" fullWidth size="large" variant="outlined" startIcon={<img src={iAmSmartICon} alt="iAM Smart" width="30" />}><Typography variant="h5">智方便登入</Typography></Button>
</Stack>
</Grid>
<Grid item xs={12}>
<Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}>
<Button onClick={()=>openApp()} color="iAmSmart" fullWidth size="large" variant="outlined" startIcon={<img src={iAmSmartICon} alt="iAM Smart" width="30" />}><Typography variant="h5">智方便登入(App)</Typography></Button>
</Stack>
</Grid>
<Grid item xs={12}>
<Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}>
<Link href="https://www.iamsmart.gov.hk/tc/"><Typography align="center" variant="h6">{"了解更多 >"}</Typography></Link>


正在加载...
取消
保存