checkPassword method

Future<bool> checkPassword(
  1. String? username,
  2. String? password
)

Implementation

Future<bool> checkPassword(String? username, String? password) async {
  if (isEmptyString(username) || isEmptyString(password)) return false;

  var now = DateTime.now().millisecondsSinceEpoch;
  _cleanAuthentications(now);

  var count = _authenticationCount.putIfAbsent(username!, () => 0);
  if (count > 10) return false;

  _authenticationCount[username] = count + 1;
  _authenticationTime[username] = now;

  var ok = await _authenticationGrantor(username, password!);
  return ok;
}