File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ fn config() -> Json<Value> {
225225 "url" : "https://github.com/dani-garcia/vaultwarden"
226226 } ,
227227 "settings" : {
228- "disableUserRegistration" : ! crate :: CONFIG . signups_allowed ( ) && crate :: CONFIG . signups_domains_whitelist ( ) . is_empty ( ) ,
228+ "disableUserRegistration" : crate :: CONFIG . is_signup_disabled ( )
229229 } ,
230230 "environment" : {
231231 "vault" : domain,
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ fn not_found() -> ApiResult<Html<String>> {
5555#[ get( "/css/vaultwarden.css" ) ]
5656fn vaultwarden_css ( ) -> Cached < Css < String > > {
5757 let css_options = json ! ( {
58- "signup_disabled" : ! CONFIG . signups_allowed ( ) && CONFIG . signups_domains_whitelist ( ) . is_empty ( ) ,
58+ "signup_disabled" : CONFIG . is_signup_disabled ( ) ,
5959 "mail_enabled" : CONFIG . mail_enabled( ) ,
6060 "mail_2fa_enabled" : CONFIG . _enable_email_2fa( ) ,
6161 "yubico_enabled" : CONFIG . _enable_yubico( ) && CONFIG . yubico_client_id( ) . is_some( ) && CONFIG . yubico_secret_key( ) . is_some( ) ,
Original file line number Diff line number Diff line change @@ -1354,6 +1354,14 @@ impl Config {
13541354 }
13551355 }
13561356
1357+ // The registration link should be hidden if signup is not allowed and whitelist is empty
1358+ // unless mail is disabled and invitations are allowed
1359+ pub fn is_signup_disabled ( & self ) -> bool {
1360+ !self . signups_allowed ( )
1361+ && self . signups_domains_whitelist ( ) . is_empty ( )
1362+ && ( self . mail_enabled ( ) || !self . invitations_allowed ( ) )
1363+ }
1364+
13571365 /// Tests whether the specified user is allowed to create an organization.
13581366 pub fn is_org_creation_allowed ( & self , email : & str ) -> bool {
13591367 let users = self . org_creation_users ( ) ;
You can’t perform that action at this time.
0 commit comments