refactor: auth

This commit is contained in:
cogwheel0
2025-08-29 12:58:56 +05:30
parent abc40b3958
commit f0b9e8e2b0
6 changed files with 73 additions and 34 deletions

View File

@@ -16,6 +16,7 @@ import '../../../shared/widgets/conduit_components.dart';
import '../../../core/auth/auth_state_manager.dart';
import '../../../core/utils/debug_logger.dart';
import 'package:conduit/l10n/app_localizations.dart';
import '../providers/unified_auth_providers.dart';
class AuthenticationPage extends ConsumerStatefulWidget {
final ServerConfig serverConfig;
@@ -71,16 +72,16 @@ class _AuthenticationPageState extends ConsumerState<AuthenticationPage> {
});
try {
final authManager = ref.read(authStateManagerProvider.notifier);
final actions = ref.read(authActionsProvider);
bool success;
if (_useApiKey) {
success = await authManager.loginWithApiKey(
success = await actions.loginWithApiKey(
_apiKeyController.text.trim(),
rememberCredentials: true, // Consistent with credentials method
);
} else {
success = await authManager.login(
success = await actions.login(
_usernameController.text.trim(),
_passwordController.text,
rememberCredentials: true,