authenticateEmail method
Future<Session>
authenticateEmail({
- String? email,
- String? username,
- required String password,
- bool create = false,
- Map<
String, String> ? vars,
override
Implementation
@override
Future<model.Session> authenticateEmail({
String? email,
String? username,
required String password,
bool create = false,
Map<String, String>? vars,
}) async {
assert(email != null || username != null);
assert(create == false || email != null);
// Create the account email object
final accountEmail = api.AccountEmail()
..password = password
..vars.addAll(vars ?? {});
if (email != null) {
accountEmail.email = email;
}
// Create the request
final request = api.AuthenticateEmailRequest()
..create_2 = api.BoolValue(value: create)
..account = accountEmail;
if (username != null) {
request.username = username;
}
final res = await _client.authenticateEmail(request);
return model.Session.fromDto(res);
}