setPassword method
Future<void>
setPassword(
- Session session, {
- required EmailAccount emailAccount,
- required String? password,
- required Transaction transaction,
Sets the password for the authentication belonging to the given email account.
The password argument is not checked against the configured password
policy.
If password is null, an empty password hash will be set making it
impossible to login with the email account.
Implementation
Future<void> setPassword(
final Session session, {
required final EmailAccount emailAccount,
required final String? password,
required final Transaction transaction,
}) async {
final passwordHash = switch (password) {
null => '',
final String value => await _passwordHashUtil.createHashFromString(
secret: value,
),
};
await EmailAccount.db.updateRow(
session,
emailAccount.copyWith(
passwordHash: passwordHash,
),
transaction: transaction,
);
}