feat(app): clean architecture with typed repositories, DTO models and calendar event logos
This commit is contained in:
@@ -67,6 +67,14 @@ class AuthRepository {
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> changeInitialPassword(String userId, String newPassword) async {
|
||||
final res = await apiClient.post('/api/v1/auth/change-initial-password', data: {
|
||||
'userId': userId,
|
||||
'newPassword': newPassword,
|
||||
});
|
||||
return res.statusCode == 200;
|
||||
}
|
||||
|
||||
Future<void> logout() async {
|
||||
await storageService.clearAll();
|
||||
}
|
||||
@@ -76,3 +84,4 @@ class RequiresPasswordChangeException implements Exception {
|
||||
final String userId;
|
||||
RequiresPasswordChangeException(this.userId);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:finlytic_app/core/network/api_client.dart';
|
||||
import 'package:finlytic_app/core/services/secure_storage_service.dart';
|
||||
import 'package:finlytic_app/core/theme/app_theme.dart';
|
||||
import 'package:finlytic_app/features/auth/bloc/auth_bloc.dart';
|
||||
import 'package:finlytic_app/features/auth/repositories/auth_repository.dart';
|
||||
|
||||
class ChangeInitialPasswordScreen extends StatefulWidget {
|
||||
final String userId;
|
||||
@@ -23,13 +25,13 @@ class _ChangeInitialPasswordScreenState extends State<ChangeInitialPasswordScree
|
||||
if (_formKey.currentState?.validate() ?? false) {
|
||||
setState(() => _isLoading = true);
|
||||
try {
|
||||
final apiClient = context.read<ApiClient>();
|
||||
final res = await apiClient.post('/api/v1/auth/change-initial-password', data: {
|
||||
'userId': widget.userId,
|
||||
'newPassword': _passwordController.text,
|
||||
});
|
||||
final authRepo = AuthRepository(
|
||||
apiClient: context.read<ApiClient>(),
|
||||
storageService: context.read<SecureStorageService>(),
|
||||
);
|
||||
final success = await authRepo.changeInitialPassword(widget.userId, _passwordController.text);
|
||||
|
||||
if (res.statusCode == 200) {
|
||||
if (success) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Passwort erfolgreich geändert! Bitte melden Sie sich erneut an.'), backgroundColor: AppTheme.accentCyan),
|
||||
|
||||
Reference in New Issue
Block a user