ec5556d8 by Jonille Arreglo

27190_loggedin

1 parent 147ec800
1 let aiUser = btutil_getCookie('aiwp_logged_in');
2 let objBody = { aiwp_logged_in: aiUser };
3
4 let params = [];
5 params['objBody'] = objBody;
6 params['strUrl'] = 'https://test.api.ai-pro.org/e/v1/authenticate/'; //use envvar for https://test.api.ai-pro.org/ only
7
8 btutil_checkAuthentication(params, cbCheckAuthentication, cbErrCheckAuthentication);
9 function cbCheckAuthentication(res) {
10 // console.log(res);
11 if (!res.success) {
12 window.location.href = "https://ai-pro.org/redirect-account-required/"; //use envvar
13 } else {
14 document.getElementById("root").classList.add("active");
15 }
16 }
17
18 function cbErrCheckAuthentication(res) {
19 console.log(res);
20 }
...\ No newline at end of file ...\ No newline at end of file
...@@ -26,6 +26,33 @@ ...@@ -26,6 +26,33 @@
26 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`.
27 --> 27 -->
28 <title>AI-Pro ChatGPT</title> 28 <title>AI-Pro ChatGPT</title>
29 <script src='%REACT_APP_S3_LINK%/common/btutil-authenticate.min.js'></script>
30 <script>
31 let aiUser = btutil_getCookie('aiwp_logged_in');
32 if(!aiUser) {
33 window.location.href = '%REACT_APP_REDIRECT_ACCOUNT%';
34 } else {
35 let objBody = { aiwp_logged_in: aiUser };
36
37 let params = [];
38 params['objBody'] = objBody;
39 params['strUrl'] = '%REACT_APP_API_LINK%/e/v1/authenticate/';
40
41 btutil_checkAuthentication(params, cbCheckAuthentication, cbErrCheckAuthentication);
42 function cbCheckAuthentication(res) {
43 // console.log(res);
44 if (!res.success) {
45 window.location.href = '%REACT_APP_REDIRECT_ACCOUNT%';
46 } else {
47 document.getElementById("root").classList.add("active");
48 }
49 }
50
51 function cbErrCheckAuthentication(res) {
52 console.log(res);
53 }
54 }
55 </script>
29 </head> 56 </head>
30 <body> 57 <body>
31 <noscript>You need to enable JavaScript to run this app.</noscript> 58 <noscript>You need to enable JavaScript to run this app.</noscript>
......
...@@ -16,6 +16,3 @@ root.render( ...@@ -16,6 +16,3 @@ root.render(
16 // to log results (for example: reportWebVitals(console.log)) 16 // to log results (for example: reportWebVitals(console.log))
17 // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 17 // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
18 reportWebVitals(); 18 reportWebVitals();
19
20 appendScript("https://btcomponent-1devt.s3.us-east-1.amazonaws.com/common/btutil-authenticate.min.js");
21 appendScript("http://localhost:3000/assets/js/auth.js");
...\ No newline at end of file ...\ No newline at end of file
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!