mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 05:25:40 +09:00
fix: remove Flutter captcha bypass (#1234)
This commit is contained in:
1 parent
a61134d2c3
commit
d5cc48a92d
2 files changed
+2
-9
No files matched your search
@@ -39,7 +39,7 @@ import {
|
|||||||
} from '@fluxer/schema/src/domains/auth/AuthSchemas';
|
} from '@fluxer/schema/src/domains/auth/AuthSchemas';
|
||||||
import {Config} from '../Config';
|
import {Config} from '../Config';
|
||||||
import {DefaultUserOnly, LoginRequiredAllowSuspicious} from '../middleware/AuthMiddleware';
|
import {DefaultUserOnly, LoginRequiredAllowSuspicious} from '../middleware/AuthMiddleware';
|
||||||
import {CaptchaMiddleware, CaptchaMiddlewareSkipFlutter} from '../middleware/CaptchaMiddleware';
|
import {CaptchaMiddleware} from '../middleware/CaptchaMiddleware';
|
||||||
import {LocalAuthMiddleware} from '../middleware/LocalAuthMiddleware';
|
import {LocalAuthMiddleware} from '../middleware/LocalAuthMiddleware';
|
||||||
import {RateLimitMiddleware} from '../middleware/RateLimitMiddleware';
|
import {RateLimitMiddleware} from '../middleware/RateLimitMiddleware';
|
||||||
import {OpenAPI} from '../middleware/ResponseTypeMiddleware';
|
import {OpenAPI} from '../middleware/ResponseTypeMiddleware';
|
||||||
@@ -133,7 +133,7 @@ export function AuthController(app: HonoApp) {
|
|||||||
app.post(
|
app.post(
|
||||||
'/auth/login',
|
'/auth/login',
|
||||||
LocalAuthMiddleware,
|
LocalAuthMiddleware,
|
||||||
CaptchaMiddlewareSkipFlutter,
|
CaptchaMiddleware,
|
||||||
RateLimitMiddleware(RateLimitConfigs.AUTH_LOGIN),
|
RateLimitMiddleware(RateLimitConfigs.AUTH_LOGIN),
|
||||||
Validator('json', LoginRequest),
|
Validator('json', LoginRequest),
|
||||||
OpenAPI({
|
OpenAPI({
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import type {InstanceCaptchaEffectiveConfig, InstanceCaptchaProvider} from '../i
|
|||||||
import type {User} from '../models/User';
|
import type {User} from '../models/User';
|
||||||
import {accountPolicyContactHasCapability} from '../risk/AccountPolicyService';
|
import {accountPolicyContactHasCapability} from '../risk/AccountPolicyService';
|
||||||
import type {HonoEnv} from '../types/HonoEnv';
|
import type {HonoEnv} from '../types/HonoEnv';
|
||||||
import {isFluxerFlutterClient} from '../utils/UserAgentUtils';
|
|
||||||
|
|
||||||
function resolveProviderSecret(
|
function resolveProviderSecret(
|
||||||
config: InstanceCaptchaEffectiveConfig,
|
config: InstanceCaptchaEffectiveConfig,
|
||||||
@@ -88,9 +87,3 @@ export const CaptchaMiddleware = createMiddleware<HonoEnv>(async (ctx, next) =>
|
|||||||
await verifyCaptchaToken(ctx);
|
await verifyCaptchaToken(ctx);
|
||||||
await next();
|
await next();
|
||||||
});
|
});
|
||||||
export const CaptchaMiddlewareSkipFlutter = createMiddleware<HonoEnv>(async (ctx, next) => {
|
|
||||||
if (!isFluxerFlutterClient(ctx.req.raw)) {
|
|
||||||
await verifyCaptchaToken(ctx);
|
|
||||||
}
|
|
||||||
await next();
|
|
||||||
});
|
|
||||||
Reference in new issue
Block a user