@@ -16,6 +16,7 @@ import (
16
16
"code.gitea.io/gitea/modules/context"
17
17
"code.gitea.io/gitea/modules/hcaptcha"
18
18
"code.gitea.io/gitea/modules/log"
19
+ "code.gitea.io/gitea/modules/mcaptcha"
19
20
"code.gitea.io/gitea/modules/recaptcha"
20
21
"code.gitea.io/gitea/modules/session"
21
22
"code.gitea.io/gitea/modules/setting"
@@ -40,6 +41,8 @@ func LinkAccount(ctx *context.Context) {
40
41
ctx .Data ["RecaptchaURL" ] = setting .Service .RecaptchaURL
41
42
ctx .Data ["RecaptchaSitekey" ] = setting .Service .RecaptchaSitekey
42
43
ctx .Data ["HcaptchaSitekey" ] = setting .Service .HcaptchaSitekey
44
+ ctx .Data ["McaptchaSitekey" ] = setting .Service .McaptchaSitekey
45
+ ctx .Data ["McaptchaURL" ] = setting .Service .McaptchaURL
43
46
ctx .Data ["DisableRegistration" ] = setting .Service .DisableRegistration
44
47
ctx .Data ["AllowOnlyInternalRegistration" ] = setting .Service .AllowOnlyInternalRegistration
45
48
ctx .Data ["ShowRegistrationButton" ] = false
@@ -96,6 +99,8 @@ func LinkAccountPostSignIn(ctx *context.Context) {
96
99
ctx .Data ["CaptchaType" ] = setting .Service .CaptchaType
97
100
ctx .Data ["RecaptchaSitekey" ] = setting .Service .RecaptchaSitekey
98
101
ctx .Data ["HcaptchaSitekey" ] = setting .Service .HcaptchaSitekey
102
+ ctx .Data ["McaptchaSitekey" ] = setting .Service .McaptchaSitekey
103
+ ctx .Data ["McaptchaURL" ] = setting .Service .McaptchaURL
99
104
ctx .Data ["DisableRegistration" ] = setting .Service .DisableRegistration
100
105
ctx .Data ["ShowRegistrationButton" ] = false
101
106
@@ -195,6 +200,8 @@ func LinkAccountPostRegister(ctx *context.Context) {
195
200
ctx .Data ["CaptchaType" ] = setting .Service .CaptchaType
196
201
ctx .Data ["RecaptchaSitekey" ] = setting .Service .RecaptchaSitekey
197
202
ctx .Data ["HcaptchaSitekey" ] = setting .Service .HcaptchaSitekey
203
+ ctx .Data ["McaptchaSitekey" ] = setting .Service .McaptchaSitekey
204
+ ctx .Data ["McaptchaURL" ] = setting .Service .McaptchaURL
198
205
ctx .Data ["DisableRegistration" ] = setting .Service .DisableRegistration
199
206
ctx .Data ["ShowRegistrationButton" ] = false
200
207
@@ -233,6 +240,8 @@ func LinkAccountPostRegister(ctx *context.Context) {
233
240
valid , err = recaptcha .Verify (ctx , form .GRecaptchaResponse )
234
241
case setting .HCaptcha :
235
242
valid , err = hcaptcha .Verify (ctx , form .HcaptchaResponse )
243
+ case setting .MCaptcha :
244
+ valid , err = mcaptcha .Verify (ctx , form .McaptchaResponse )
236
245
default :
237
246
ctx .ServerError ("Unknown Captcha Type" , fmt .Errorf ("Unknown Captcha Type: %s" , setting .Service .CaptchaType ))
238
247
return
0 commit comments