login method

Future<void> login()

Logs in a user with email and password from the text controllers.

On success, updates the session manager and calls onAuthenticated. On failure, transitions to error state with the error message.

Implementation

Future<void> login() async {
  await _guarded(EmailAuthState.authenticated, null, () async {
    final authSuccess = await _emailEndpoint.login(
      email: emailController.text.trim(),
      password: passwordController.text,
    );

    await client.auth.updateSignedInUser(authSuccess);
  });
}