login method

Future<User?> login({
  1. required String userName,
  2. required String hashedPassword,
})

Logs in the user by checking their credentials (username and hashed password).

  • userName: The username of the user attempting to log in.
  • hashedPassword: The hashed password for the user.

Returns the User if credentials are correct, otherwise returns null.

Implementation

Future<User?> login({required String userName, required String hashedPassword}) async {
  if (await isUserPasswordCorrect(userName: userName, hashedPassword: hashedPassword)) {
    return await getUserByName(userName);
  } else {
    return null;
  }
}