Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dima Krasner
Sharkey
Commits
02a43a31
Commit
02a43a31
authored
2 years ago
by
syuilo
Browse files
Options
Downloads
Patches
Plain Diff
CAPTCHA求めるのは2fa認証が無効になっているときだけにした
2faのトークンは期限付きだから、CAPTCHA解いてる間に期限切れになる
parent
9783f2de
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/backend/src/server/api/private/signin.ts
+12
-12
12 additions, 12 deletions
packages/backend/src/server/api/private/signin.ts
packages/client/src/components/signin.vue
+2
-2
2 additions, 2 deletions
packages/client/src/components/signin.vue
with
14 additions
and
14 deletions
packages/backend/src/server/api/private/signin.ts
+
12
−
12
View file @
02a43a31
...
...
@@ -20,18 +20,6 @@ export default async (ctx: Koa.Context) => {
const
instance
=
await
fetchMeta
(
true
);
if
(
instance
.
enableHcaptcha
&&
instance
.
hcaptchaSecretKey
)
{
await
verifyHcaptcha
(
instance
.
hcaptchaSecretKey
,
body
[
'
hcaptcha-response
'
]).
catch
(
e
=>
{
ctx
.
throw
(
400
,
e
);
});
}
if
(
instance
.
enableRecaptcha
&&
instance
.
recaptchaSecretKey
)
{
await
verifyRecaptcha
(
instance
.
recaptchaSecretKey
,
body
[
'
g-recaptcha-response
'
]).
catch
(
e
=>
{
ctx
.
throw
(
400
,
e
);
});
}
const
username
=
body
[
'
username
'
];
const
password
=
body
[
'
password
'
];
const
token
=
body
[
'
token
'
];
...
...
@@ -96,6 +84,18 @@ export default async (ctx: Koa.Context) => {
}
if
(
!
profile
.
twoFactorEnabled
)
{
if
(
instance
.
enableHcaptcha
&&
instance
.
hcaptchaSecretKey
)
{
await
verifyHcaptcha
(
instance
.
hcaptchaSecretKey
,
body
[
'
hcaptcha-response
'
]).
catch
(
e
=>
{
ctx
.
throw
(
400
,
e
);
});
}
if
(
instance
.
enableRecaptcha
&&
instance
.
recaptchaSecretKey
)
{
await
verifyRecaptcha
(
instance
.
recaptchaSecretKey
,
body
[
'
g-recaptcha-response
'
]).
catch
(
e
=>
{
ctx
.
throw
(
400
,
e
);
});
}
if
(
same
)
{
signin
(
ctx
,
user
);
return
;
...
...
This diff is collapsed.
Click to expand it.
packages/client/src/components/signin.vue
+
2
−
2
View file @
02a43a31
...
...
@@ -11,6 +11,8 @@
<
template
#prefix
><i
class=
"fas fa-lock"
></i></
template
>
<
template
#caption
><button
class=
"_textButton"
type=
"button"
@
click=
"resetPassword"
>
{{
$ts
.
forgotPassword
}}
</button></
template
>
</MkInput>
<MkCaptcha
v-if=
"meta.enableHcaptcha"
ref=
"hcaptcha"
v-model=
"hCaptchaResponse"
class=
"_formBlock captcha"
provider=
"hcaptcha"
:sitekey=
"meta.hcaptchaSiteKey"
/>
<MkCaptcha
v-if=
"meta.enableRecaptcha"
ref=
"recaptcha"
v-model=
"reCaptchaResponse"
class=
"_formBlock captcha"
provider=
"recaptcha"
:sitekey=
"meta.recaptchaSiteKey"
/>
<MkButton
class=
"_formBlock"
type=
"submit"
primary
:disabled=
"signing"
style=
"margin: 0 auto;"
>
{{ signing ? $ts.loggingIn : $ts.login }}
</MkButton>
</div>
<div
v-if=
"totpLogin"
class=
"2fa-signin"
:class=
"{ securityKeys: user && user.securityKeys }"
>
...
...
@@ -33,8 +35,6 @@
<
template
#label
>
{{
$ts
.
token
}}
</
template
>
<
template
#prefix
><i
class=
"fas fa-gavel"
></i></
template
>
</MkInput>
<MkCaptcha
v-if=
"meta.enableHcaptcha"
ref=
"hcaptcha"
v-model=
"hCaptchaResponse"
class=
"_formBlock captcha"
provider=
"hcaptcha"
:sitekey=
"meta.hcaptchaSiteKey"
/>
<MkCaptcha
v-if=
"meta.enableRecaptcha"
ref=
"recaptcha"
v-model=
"reCaptchaResponse"
class=
"_formBlock captcha"
provider=
"recaptcha"
:sitekey=
"meta.recaptchaSiteKey"
/>
<MkButton
type=
"submit"
:disabled=
"signing"
primary
style=
"margin: 0 auto;"
>
{{ signing ? $ts.loggingIn : $ts.login }}
</MkButton>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment