Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Administrator
/
chatgpt.ai-pro.org
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
3
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
147ec800
authored
2023-04-05 16:39:12 +0800
by
Jonille Arreglo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
27190_loggedin
1 parent
bfa168cd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
0 deletions
client/public/assets/js/auth.js
client/src/handlers/appendScript.js
client/src/index.css
client/src/index.js
client/public/assets/js/auth.js
0 → 100644
View file @
147ec80
let
aiUser
=
btutil_getCookie
(
'aiwp_logged_in'
);
let
objBody
=
{
aiwp_logged_in
:
aiUser
};
let
params
=
[];
params
[
'objBody'
]
=
objBody
;
params
[
'strUrl'
]
=
'https://test.api.ai-pro.org/e/v1/authenticate/'
;
//use envvar for https://test.api.ai-pro.org/ only
btutil_checkAuthentication
(
params
,
cbCheckAuthentication
,
cbErrCheckAuthentication
);
function
cbCheckAuthentication
(
res
)
{
// console.log(res);
if
(
!
res
.
success
)
{
window
.
location
.
href
=
"https://ai-pro.org/redirect-account-required/"
;
//use envvar
}
else
{
document
.
getElementById
(
"root"
).
classList
.
add
(
"active"
);
}
}
function
cbErrCheckAuthentication
(
res
)
{
console
.
log
(
res
);
}
\ No newline at end of file
client/src/handlers/appendScript.js
0 → 100644
View file @
147ec80
const
appendScript
=
(
scriptToAppend
,
callback
=
null
)
=>
{
const
script
=
document
.
createElement
(
"script"
);
script
.
src
=
scriptToAppend
;
script
.
async
=
false
;
document
.
body
.
appendChild
(
script
);
if
(
!
callback
)
return
;
if
(
script
.
readyState
)
{
// only required for IE <9
script
.
onreadystatechange
=
function
()
{
if
(
script
.
readyState
===
"loaded"
||
script
.
readyState
===
"complete"
)
{
script
.
onreadystatechange
=
null
;
callback
();
}
};
}
else
{
//Others
script
.
onload
=
function
()
{
callback
();
};
}
}
export
default
appendScript
;
\ No newline at end of file
client/src/index.css
View file @
147ec80
...
...
@@ -11,3 +11,7 @@ code {
font-family
:
source-code-pro
,
Menlo
,
Monaco
,
Consolas
,
'Courier New'
,
monospace
;
}
#root
:not
(
.active
)
{
display
:
none
;
}
\ No newline at end of file
...
...
client/src/index.js
View file @
147ec80
...
...
@@ -2,6 +2,7 @@ import React from 'react';
import
ReactDOM
from
'react-dom/client'
;
import
'./index.css'
;
import
App
from
'./App'
;
import
appendScript
from
'./handlers/appendScript'
;
import
reportWebVitals
from
'./reportWebVitals'
;
const
root
=
ReactDOM
.
createRoot
(
document
.
getElementById
(
'root'
));
...
...
@@ -15,3 +16,6 @@ root.render(
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals
();
appendScript
(
"https://btcomponent-1devt.s3.us-east-1.amazonaws.com/common/btutil-authenticate.min.js"
);
appendScript
(
"http://localhost:3000/assets/js/auth.js"
);
\ No newline at end of file
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment