Usun symulowane logowanie przez Google i Facebook
Deploy Polska Lokalnie / deploy (push) Successful in 30s

Endpoint /api/auth/social byl atrapa bez prawdziwego OAuth: wydawal token
sesji dla dowolnego adresu e-mail podanego w zadaniu, bez hasla. Podanie
adresu administratora dawalo pelna sesje z rola ADMIN.

Na tym etapie logowanie ma byc wylacznie dla uzytkownikow systemu (e-mail
i haslo), wiec usuwam je w calosci:

- backend: endpoint, wpis permitAll w SecurityConfig, AuthService.socialLogin
  z pomocnikami i DTO SocialLoginRequest. Enum AuthProvider zostaje, bo
  istniejace konta moga miec GOOGLE/FACEBOOK.
- frontend: przyciski Google/Facebook w formularzach logowania i rejestracji,
  socialLogin w AuthContext oraz osierocone style.

Test regresyjny AuthControllerTest nie uruchomi sie jeszcze na H2 - start
kontekstu wywraca sie na split_part w SQL naprawiajacym nicki (ten sam blad
dotyczy istniejacego contextLoads). Zweryfikowane recznie na stacku
z PostgreSQL: /api/auth/social -> 403, logowanie e-mailem -> 200.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-21 14:20:32 +02:00
parent a3e4505194
commit 4453ef2305
8 changed files with 54 additions and 210 deletions
+2 -12
View File
@@ -104,7 +104,6 @@ type AuthContextValue = {
loading: boolean;
login: (email: string, password: string) => Promise<AuthUser>;
register: (email: string, password: string, fullName: string, details?: RegisterDetails) => Promise<RegisterPending>;
socialLogin: (provider: Exclude<AuthProviderName, 'LOCAL'>) => Promise<AuthUser>;
activateAccount: (token: string) => Promise<void>;
resendActivation: (email: string) => Promise<void>;
forgotPassword: (email: string) => Promise<void>;
@@ -266,15 +265,6 @@ export function AuthProvider({ children }: { children: ReactNode }) {
[],
);
const socialLogin = useCallback(
async (provider: Exclude<AuthProviderName, 'LOCAL'>) =>
applyAuth(await apiFetch<AuthResponse>('/auth/social', {
method: 'POST',
body: JSON.stringify({ provider }),
})),
[applyAuth],
);
const activateAccount = useCallback(async (token: string) => {
await apiFetch<void>('/auth/activate', { method: 'POST', body: JSON.stringify({ token }) });
}, []);
@@ -372,11 +362,11 @@ export function AuthProvider({ children }: { children: ReactNode }) {
const value = useMemo<AuthContextValue>(
() => ({
user, token, loading, login, register, socialLogin,
user, token, loading, login, register,
activateAccount, resendActivation, forgotPassword, resetPassword, verifyPhone, resendPhoneOtp,
updateProfile, changePassword, verifyPassword, passwordCooldown, deleteAccount, loadSettings, loadSearchPreferences, saveSettings, refreshUser, logout,
}),
[user, token, loading, login, register, socialLogin,
[user, token, loading, login, register,
activateAccount, resendActivation, forgotPassword, resetPassword, verifyPhone, resendPhoneOtp,
updateProfile, changePassword, verifyPassword, passwordCooldown, deleteAccount, loadSettings, loadSearchPreferences, saveSettings, refreshUser, logout],
);