updatePassword method

  1. @override
Future<Response> updatePassword(
  1. String email,
  2. String password,
  3. String newPassword,
  4. String jwt,
)
override

Changes the user's password in the service using email, password, newPassword and jwt

Implementation

@override
Future<Response> updatePassword(
    String email, String password, String newPassword, String jwt) {
  if (email.isEmpty ||
      password.isEmpty ||
      newPassword.isEmpty ||
      jwt.isEmpty) {
    throw Exception('The arguments must be not empty');
  }
  if (!EmailValidator.validate(email)) {
    throw Exception('E-mail must be valid');
  }
  if (password.length < 8) {
    throw Exception('The password must have at least eight characters');
  } else {
    return _service.updatePassword(email, password, newPassword, jwt);
  }
}