Skip to content

Conversation

@EnesEfeTokta
Copy link
Owner

This pull request introduces several key updates to the FinTrack project, including a new secure token storage mechanism, synchronization status tracking for models, and enhancements to authentication workflows. Additionally, minor changes were made to the base address of the AuthService and a placeholder HomeViewModel was added.

Security and Authentication Enhancements:

  • Added SecureTokenStorage class: Implements secure storage for user tokens using ProtectedData for encryption and decryption, with methods to save, retrieve, and clear tokens. (FinTrack/Core/SecureTokenStorage.cs)
  • Updated LoginViewModel: Integrated SecureTokenStorage to automatically log in users with a saved token and to save tokens upon successful login. (FinTrack/ViewModels/LoginViewModel.cs) [1] [2]

Model Synchronization:

  • Added IsSynced property: Introduced a bool IsSynced property to track synchronization status for the following models:
    • AccountModel (FinTrack/Models/AccountModel.cs)
    • BudgetCategoryModel (FinTrack/Models/BudgetCategoryModel.cs)
    • BudgetModel (FinTrack/Models/BudgetModel.cs)
    • CategoryModel (FinTrack/Models/CategoryModel.cs)
    • TransactionModel (FinTrack/Models/TransactionModel.cs)
    • UserSettingsModel (FinTrack/Models/UserSettingsModel.cs)

Minor Updates:

  • Updated AuthService base address: Changed the base URL from http://localhost:5246/ to http://localhost:5000/. (FinTrack/Services/AuthService.cs)
  • Added HomeViewModel: Created a placeholder HomeViewModel class inheriting from ObservableObject. (FinTrack/ViewModels/HomeViewModel.cs)

Introduced SecureTokenStorage for encrypted token management and updated LoginViewModel to support token persistence and auto-login. Added IsSynced property to key models (Account, Budget, Category, Transaction, UserSettings, BudgetCategory) to track synchronization status. Updated AuthService base address.
…torage

Introduces a new HomeViewModel class inheriting from ObservableObject for MVVM support. Also reorders using directives in SecureTokenStorage.cs for consistency.
@EnesEfeTokta EnesEfeTokta requested a review from Copilot June 27, 2025 14:35
@EnesEfeTokta EnesEfeTokta self-assigned this Jun 27, 2025
@EnesEfeTokta EnesEfeTokta added the enhancement New feature or request label Jun 27, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces security enhancements and synchronization tracking into the FinTrack project by integrating secure token storage in the authentication workflow and adding an IsSynced property to various models.

  • Integrates SecureTokenStorage into LoginViewModel to automatically log in users with saved tokens.
  • Adds an IsSynced property to multiple models to track synchronization status.
  • Updates AuthService base URL and introduces a placeholder HomeViewModel.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
FinTrack/ViewModels/LoginViewModel.cs Integrates secure token login and token saving in authentication flow
FinTrack/ViewModels/HomeViewModel.cs Adds a placeholder HomeViewModel class
FinTrack/Services/AuthService.cs Updates the AuthService base URL
FinTrack/Models/UserSettingsModel.cs Adds IsSynced property for sync status tracking
FinTrack/Models/TransactionModel.cs Adds IsSynced property for sync status tracking
FinTrack/Models/CategoryModel.cs Adds IsSynced property for sync status tracking
FinTrack/Models/BudgetModel.cs Adds IsSynced property for sync status tracking
FinTrack/Models/BudgetCategoryModel.cs Adds IsSynced property for sync status tracking
FinTrack/Models/AccountModel.cs Adds IsSynced property for sync status tracking
FinTrack/Core/SecureTokenStorage.cs Implements secure token storage using ProtectedData

if (!string.IsNullOrEmpty(token))
{
SessionManager.SetToken(token);
MessageBox.Show("Giriş başarılı! Token kullanıldı.", "Bilgi", MessageBoxButton.OK, MessageBoxImage.Information);
Copy link

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider decoupling UI messaging from the ViewModel by using an event or messaging service instead of directly calling MessageBox.Show to improve testability and separation of concerns.

Copilot uses AI. Check for mistakes.
}
catch (Exception ex)
{
Console.WriteLine($"Error saving token: {ex.Message}");
Copy link

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider replacing Console.WriteLine with a proper logging framework to improve error tracking and maintainability in production environments.

Copilot uses AI. Check for mistakes.
@EnesEfeTokta EnesEfeTokta merged commit 3ec9981 into main Jun 27, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants