Merge branch '27528_apply_authv2_chatgpt' into 'master'
27528_apply_authv2_chatgpt See merge request !61
Showing
2 changed files
with
4 additions
and
30 deletions
| ... | @@ -11,7 +11,6 @@ | ... | @@ -11,7 +11,6 @@ |
| 11 | content="Web site created using create-react-app" | 11 | content="Web site created using create-react-app" |
| 12 | /> | 12 | /> |
| 13 | <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> | 13 | <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> |
| 14 | <script src='https://api.ai-pro.org/ext-app/js/btutil-common-v1.min.js?ver=202306291729'></script> | ||
| 15 | <!-- | 14 | <!-- |
| 16 | manifest.json provides metadata used when your web app is installed on a | 15 | manifest.json provides metadata used when your web app is installed on a |
| 17 | user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ | 16 | user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ |
| ... | @@ -27,32 +26,11 @@ | ... | @@ -27,32 +26,11 @@ |
| 27 | Learn how to configure a non-root public URL by running `npm run build`. | 26 | Learn how to configure a non-root public URL by running `npm run build`. |
| 28 | --> | 27 | --> |
| 29 | <title>AI-Pro ChatGPT</title> | 28 | <title>AI-Pro ChatGPT</title> |
| 30 | <script src='%REACT_APP_BTCOMPONENT_S3_URL%/common/btutil-authenticate.min.js'></script> | ||
| 31 | <script> | 29 | <script> |
| 32 | let aiUser = btutil_getCookie('aiwp_logged_in'); | 30 | let ver = new Date().getTime(); |
| 33 | if(!aiUser) { | 31 | let btutilAsset = document.createElement('script'); |
| 34 | window.location.href = '%REACT_APP_AUTH_FAILED_REDIRECTION_URL%'; | 32 | btutilAsset.setAttribute('src', "%REACT_APP_BTUTIL_ASSET_URL%" + ver); |
| 35 | } else { | 33 | document.head.appendChild(btutilAsset); |
| 36 | let objBody = { aiwp_logged_in: aiUser }; | ||
| 37 | |||
| 38 | let params = []; | ||
| 39 | params['objBody'] = objBody; | ||
| 40 | params['strUrl'] = '%REACT_APP_EXTERNAL_API_URL%/e/v1/authenticate/'; | ||
| 41 | |||
| 42 | btutil_checkAuthentication(params, cbCheckAuthentication, cbErrCheckAuthentication); | ||
| 43 | function cbCheckAuthentication(res) { | ||
| 44 | // console.log(res); | ||
| 45 | if (!res.success) { | ||
| 46 | window.location.href = '%REACT_APP_AUTH_FAILED_REDIRECTION_URL%'; | ||
| 47 | } else { | ||
| 48 | document.getElementById("root").classList.add("active"); | ||
| 49 | } | ||
| 50 | } | ||
| 51 | |||
| 52 | function cbErrCheckAuthentication(res) { | ||
| 53 | console.log(res); | ||
| 54 | } | ||
| 55 | } | ||
| 56 | </script> | 34 | </script> |
| 57 | </head> | 35 | </head> |
| 58 | <body> | 36 | <body> | ... | ... |
| ... | @@ -10,8 +10,4 @@ body { | ... | @@ -10,8 +10,4 @@ body { |
| 10 | code { | 10 | code { |
| 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', | 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', |
| 12 | monospace; | 12 | monospace; |
| 13 | } | ||
| 14 | |||
| 15 | #root:not(.active) { | ||
| 16 | display: none; | ||
| 17 | } | 13 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment