setPassword method
Sets the password for the authentication belonging to the given email.
The password argument is not checked against the configured password
policy.
Throws an EmailAccountNotFoundException in case no account exists for the given email address.
Implementation
Future<void> setPassword(
final Session session, {
required String email,
required final String password,
final Transaction? transaction,
}) async {
return DatabaseUtil.runInTransactionOrSavepoint(
session.db,
transaction,
(final transaction) async {
email = email.normalizedEmail;
final account = (await _utils.account.listAccounts(
session,
email: email,
transaction: transaction,
)).singleOrNull;
if (account == null) {
throw EmailAccountNotFoundException();
}
return _utils.passwordReset.setPassword(
session,
emailAccount: account,
password: password,
transaction: transaction,
);
},
);
}