Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Moecube Accounts Web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Moecube Accounts Web
Commits
2c3bc432
Commit
2c3bc432
authored
Jul 08, 2024
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add vaptcha
parent
c93db18d
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
370 additions
and
248 deletions
+370
-248
public/index.html
public/index.html
+1
-0
src/services/auth.js
src/services/auth.js
+2
-0
src/services/user.js
src/services/user.js
+1
-0
src/utils/request.js
src/utils/request.js
+31
-0
yarn.lock
yarn.lock
+335
-248
No files found.
public/index.html
View file @
2c3bc432
...
...
@@ -5,6 +5,7 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<link
rel=
"stylesheet"
href=
"index.css"
/>
<link
rel=
"icon"
href=
"https://moecube.com/favicon.ico"
>
<script
src=
"https://v-cn.vaptcha.com/v3.js"
></script>
</head>
<body>
...
...
src/services/auth.js
View file @
2c3bc432
...
...
@@ -18,6 +18,7 @@ export async function register(params) {
return
request
(
'
/signup
'
,
{
method
:
'
POST
'
,
body
:
JSON
.
stringify
(
params
),
vaptcha
:
true
,
});
}
...
...
@@ -25,6 +26,7 @@ export async function reset(params) {
return
request
(
'
/reset
'
,
{
method
:
'
PATCH
'
,
body
:
JSON
.
stringify
(
params
),
vaptcha
:
true
,
});
}
...
...
src/services/user.js
View file @
2c3bc432
...
...
@@ -19,5 +19,6 @@ export async function updateAccount(params) {
Authorization
:
`Bearer
${
params
.
token
}
`
,
'
content-type
'
:
'
application/json
'
,
},
vaptcha
:
true
,
});
}
src/utils/request.js
View file @
2c3bc432
...
...
@@ -22,6 +22,16 @@ async function checkStatus(response) {
throw
error
;
}
let
vaptchaObj
=
null
;
vaptcha
({
vid
:
'
668bf0efd3784602950e94a8
'
,
type
:
'
invisible
'
,
scene
:
0
,
area
:
'
auto
'
,
}).
then
((
v
)
=>
{
vaptchaObj
=
v
;
});
/**
* Requests a URL, returning a promise.
*
...
...
@@ -30,6 +40,27 @@ async function checkStatus(response) {
* @return {object} An object containing either "data" or "err"
*/
export
default
function
request
(
relativeUrl
,
options
)
{
if
(
options
.
vaptcha
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
vaptchaObj
.
listen
(
'
pass
'
,
()
=>
{
options
.
vaptcha
=
undefined
;
const
token
=
vaptchaObj
.
getServerToken
();
console
.
log
(
'
vaptcha pass
'
,
token
.
server
,
token
.
token
);
options
.
headers
=
{
...
options
.
headers
||
{
'
content-type
'
:
'
application/json
'
},
'
x-vaptcha-server
'
:
token
.
server
,
'
x-vaptcha-token
'
:
token
.
token
,
};
request
(
relativeUrl
,
options
).
then
(
resolve
).
catch
(
reject
);
vaptchaObj
.
reset
();
});
vaptchaObj
.
listen
(
'
close
'
,
()
=>
{
console
.
log
(
'
vaptcha close
'
);
reject
(
new
Error
(
'
vaptcha close
'
));
})
vaptchaObj
.
validate
();
});
}
const
url
=
`
${
config
.
apiRoot
}${
relativeUrl
}
`
;
if
(
options
&&
!
options
.
headers
)
{
Object
.
assign
(
options
,
{
...
...
yarn.lock
View file @
2c3bc432
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment