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(
Session session, {
required String email,
required String password,
Transaction? transaction,
}) async {
return DatabaseUtil.runInTransactionOrSavepoint(
session.db,
transaction,
(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,
);
},
);
}