feat(auth): integrate Captcha validation in PasswordAuthenticator
- Added CaptchaGuard dependency to PasswordAuthenticator. - Implemented Captcha validation in the authenticate method to enhance security. - Updated the login modal in home.html.twig to redirect to the admin panel instead of opening a modal. - Enhanced the Altcha widget with localized strings for better user experience. - Removed the login modal implementation from home.html.twig to streamline the login process. - Updated manifest.json and AST cache files to reflect changes in the codebase.
This commit is contained in:
@@ -10,12 +10,23 @@ interface AltchaProps {
|
||||
challengeUrl?: string;
|
||||
}
|
||||
|
||||
// برچسبهای فارسی widget (ترجمهی رسمی locale fa).
|
||||
const FA_STRINGS = JSON.stringify({
|
||||
label: 'من ربات نیستم',
|
||||
verifying: 'در حال بررسی...',
|
||||
verified: 'تأیید شد',
|
||||
waitAlert: 'در حال بررسی... لطفاً منتظر بمانید.',
|
||||
error: 'احراز هویت ناموفق بود. کمی بعد دوباره تلاش کنید.',
|
||||
expired: 'احراز هویت منقضی شد. دوباره تلاش کنید.',
|
||||
});
|
||||
|
||||
// altcha-widget یک custom element است؛ به JSX معرفی میشود (React 19: namespace زیر React.JSX).
|
||||
declare module 'react' {
|
||||
namespace JSX {
|
||||
interface IntrinsicElements {
|
||||
'altcha-widget': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
|
||||
challengeurl?: string;
|
||||
strings?: string;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -39,5 +50,5 @@ export default function Altcha({ onVerified, challengeUrl = '/api/v1/altcha/chal
|
||||
return () => el.removeEventListener('statechange', onStateChange);
|
||||
}, [onVerified]);
|
||||
|
||||
return <altcha-widget ref={ref as React.Ref<HTMLElement>} challengeurl={challengeUrl} />;
|
||||
return <altcha-widget ref={ref as React.Ref<HTMLElement>} challengeurl={challengeUrl} strings={FA_STRINGS} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user