merge: v2.0.4+24 login fixes + backend URL fix
- Google OAuth serverClientId wired (639347358523-mtkm...apps.googleusercontent.com) - Timeout 10s→25s + retry on SocketException/TimeoutException - Forgot Password glassmorphism bottom sheet with safe-degrade - Same-page signup AnimatedSwitcher (mobile + desktop); delete old RegisterScreen classes - Guest SnackBar removed from HomeScreen; LoginScreen clearSnackBars() guard - baseUrl: em.eventifyplus.com → backend.eventifyplus.com (broken TLS fix — real root cause) - Version: 2.0.4+24 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,13 @@ import '../models/user_model.dart';
|
||||
class AuthService {
|
||||
final ApiClient _api = ApiClient();
|
||||
|
||||
/// Google OAuth 2.0 Web Client ID from Google Cloud Console.
|
||||
/// Must match the `GOOGLE_CLIENT_ID` env var set on the Django backend
|
||||
/// so the server can verify the `id_token` audience.
|
||||
/// Source: Google Cloud Console → APIs & Services → Credentials → Web application.
|
||||
static const String _googleWebClientId =
|
||||
'639347358523-mtkm3i8vssuhsun80rp2llt09eou0p8g.apps.googleusercontent.com';
|
||||
|
||||
/// LOGIN → returns UserModel
|
||||
Future<UserModel> login(String username, String password) async {
|
||||
try {
|
||||
@@ -158,7 +165,10 @@ class AuthService {
|
||||
/// GOOGLE OAUTH LOGIN → returns UserModel
|
||||
Future<UserModel> googleLogin() async {
|
||||
try {
|
||||
final googleSignIn = GoogleSignIn(scopes: ['email']);
|
||||
final googleSignIn = GoogleSignIn(
|
||||
scopes: const ['email', 'profile'],
|
||||
serverClientId: _googleWebClientId,
|
||||
);
|
||||
final account = await googleSignIn.signIn();
|
||||
if (account == null) throw Exception('Google sign-in cancelled');
|
||||
|
||||
@@ -215,6 +225,16 @@ class AuthService {
|
||||
}
|
||||
}
|
||||
|
||||
/// FORGOT PASSWORD → backend sends reset instructions by email.
|
||||
/// Frontend never leaks whether the email is registered — same UX on success and 404.
|
||||
Future<void> forgotPassword(String email) async {
|
||||
await _api.post(
|
||||
ApiEndpoints.forgotPassword,
|
||||
body: {'email': email},
|
||||
requiresAuth: false,
|
||||
);
|
||||
}
|
||||
|
||||
/// Logout – clear auth token and current_email (keep per-account display_name entries so they persist)
|
||||
Future<void> logout() async {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user