mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-12-16 04:09:03 +00:00
fix hiding of signup link (#6113)
Some checks failed
Build / Build and Test ${{ matrix.channel }} (msrv) (push) Has been cancelled
Build / Build and Test ${{ matrix.channel }} (rust-toolchain) (push) Has been cancelled
Check templates / Validate docker templates (push) Has been cancelled
Hadolint / Validate Dockerfile syntax (push) Has been cancelled
Release / Cancel older jobs when running (push) Has been cancelled
Trivy / Trivy Scan (push) Has been cancelled
Security Analysis with zizmor / Run zizmor (push) Has been cancelled
Release / Build Vaultwarden containers (alpine) (push) Has been cancelled
Release / Build Vaultwarden containers (debian) (push) Has been cancelled
Some checks failed
Build / Build and Test ${{ matrix.channel }} (msrv) (push) Has been cancelled
Build / Build and Test ${{ matrix.channel }} (rust-toolchain) (push) Has been cancelled
Check templates / Validate docker templates (push) Has been cancelled
Hadolint / Validate Dockerfile syntax (push) Has been cancelled
Release / Cancel older jobs when running (push) Has been cancelled
Trivy / Trivy Scan (push) Has been cancelled
Security Analysis with zizmor / Run zizmor (push) Has been cancelled
Release / Build Vaultwarden containers (alpine) (push) Has been cancelled
Release / Build Vaultwarden containers (debian) (push) Has been cancelled
The registration link should be hidden if signup is not allowed and whitelist is empty unless mail is disabled and invitations are allowed
This commit is contained in:
parent
0db4b00007
commit
5d84f17600
@ -225,7 +225,7 @@ fn config() -> Json<Value> {
|
|||||||
"url": "https://github.com/dani-garcia/vaultwarden"
|
"url": "https://github.com/dani-garcia/vaultwarden"
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"disableUserRegistration": !crate::CONFIG.signups_allowed() && crate::CONFIG.signups_domains_whitelist().is_empty(),
|
"disableUserRegistration": crate::CONFIG.is_signup_disabled()
|
||||||
},
|
},
|
||||||
"environment": {
|
"environment": {
|
||||||
"vault": domain,
|
"vault": domain,
|
||||||
|
|||||||
@ -55,7 +55,7 @@ fn not_found() -> ApiResult<Html<String>> {
|
|||||||
#[get("/css/vaultwarden.css")]
|
#[get("/css/vaultwarden.css")]
|
||||||
fn vaultwarden_css() -> Cached<Css<String>> {
|
fn vaultwarden_css() -> Cached<Css<String>> {
|
||||||
let css_options = json!({
|
let css_options = json!({
|
||||||
"signup_disabled": !CONFIG.signups_allowed() && CONFIG.signups_domains_whitelist().is_empty(),
|
"signup_disabled": CONFIG.is_signup_disabled(),
|
||||||
"mail_enabled": CONFIG.mail_enabled(),
|
"mail_enabled": CONFIG.mail_enabled(),
|
||||||
"mail_2fa_enabled": CONFIG._enable_email_2fa(),
|
"mail_2fa_enabled": CONFIG._enable_email_2fa(),
|
||||||
"yubico_enabled": CONFIG._enable_yubico() && CONFIG.yubico_client_id().is_some() && CONFIG.yubico_secret_key().is_some(),
|
"yubico_enabled": CONFIG._enable_yubico() && CONFIG.yubico_client_id().is_some() && CONFIG.yubico_secret_key().is_some(),
|
||||||
|
|||||||
@ -1354,6 +1354,14 @@ impl Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The registration link should be hidden if signup is not allowed and whitelist is empty
|
||||||
|
// unless mail is disabled and invitations are allowed
|
||||||
|
pub fn is_signup_disabled(&self) -> bool {
|
||||||
|
!self.signups_allowed()
|
||||||
|
&& self.signups_domains_whitelist().is_empty()
|
||||||
|
&& (self.mail_enabled() || !self.invitations_allowed())
|
||||||
|
}
|
||||||
|
|
||||||
/// Tests whether the specified user is allowed to create an organization.
|
/// Tests whether the specified user is allowed to create an organization.
|
||||||
pub fn is_org_creation_allowed(&self, email: &str) -> bool {
|
pub fn is_org_creation_allowed(&self, email: &str) -> bool {
|
||||||
let users = self.org_creation_users();
|
let users = self.org_creation_users();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user