mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-08-30 23:28:29 +00:00
Ignore reset-password auto-enroll when mail is disabled (#7585)
Account recovery requires SMTP. When mail is off, treat the organization reset-password auto-enroll policy as inactive so invite/accept flows are not forced to supply a reset-password key. Fixes #7459
This commit is contained in:
@@ -318,6 +318,13 @@ impl OrgPolicy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn org_is_reset_password_auto_enroll(org_uuid: &OrganizationId, conn: &DbConn) -> bool {
|
pub async fn org_is_reset_password_auto_enroll(org_uuid: &OrganizationId, conn: &DbConn) -> bool {
|
||||||
|
// Account recovery depends on outbound mail. When SMTP is disabled, treat the
|
||||||
|
// auto-enroll policy as inactive so invites/registration are not forced to
|
||||||
|
// supply a reset-password key (see check_reset_password_applicable).
|
||||||
|
if !CONFIG.mail_enabled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
match OrgPolicy::find_by_org_and_type(org_uuid, OrgPolicyType::ResetPassword, conn).await {
|
match OrgPolicy::find_by_org_and_type(org_uuid, OrgPolicyType::ResetPassword, conn).await {
|
||||||
Some(policy) => match serde_json::from_str::<ResetPasswordDataModel>(&policy.data) {
|
Some(policy) => match serde_json::from_str::<ResetPasswordDataModel>(&policy.data) {
|
||||||
Ok(opts) => {
|
Ok(opts) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user