File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -367,6 +367,7 @@ def validate(self):
367
367
self .validate_site_name ()
368
368
self .validate_bench ()
369
369
self .set_site_admin_password ()
370
+ self .validate_admin_password ()
370
371
self .validate_installed_apps ()
371
372
self .validate_host_name ()
372
373
self .validate_site_config ()
@@ -392,6 +393,17 @@ def set_site_admin_password(self):
392
393
if not self .admin_password :
393
394
self .admin_password = frappe .generate_hash (length = 16 )
394
395
396
+ def validate_admin_password (self ):
397
+ # Shell characters can cause issues because they are not escaped
398
+ # https://stackoverflow.com/questions/15783701/which-characters-need-to-be-escaped-when-using-bash/44581064#44581064
399
+ if not self .is_new ():
400
+ return # Only validate on new sites, changing the password once created does nothing (yet)
401
+ if not self .admin_password or self .is_dummy_password (self .admin_password ):
402
+ return
403
+ SHELL_CHARS = " !\" #$&'()*,;<>?[\\ ]^`{|}"
404
+ if any (c in SHELL_CHARS for c in self .admin_password ):
405
+ frappe .throw ("Admin password must not contain special characters" )
406
+
395
407
def validate_bench (self ):
396
408
if (
397
409
self .status not in ("Broken" , "Archived" )
You can’t perform that action at this time.
0 commit comments