File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5353from .utils import url_login
5454
5555
56+ def _is_dev_portal_instance () -> bool :
57+ """
58+ Check if the instance is a ServiceNow Developer Portal instance.
59+
60+ Returns:
61+ --------
62+ bool: True if the instance is a developer portal instance, False otherwise.
63+
64+ """
65+ instance = SNowInstance ()
66+ # Check if the instance url has the for devXXXXXX.service-now.com format (where X is a digit)
67+ if re .match (r"^https?://dev\d{6}\.service-now\.com" , instance .snow_url ):
68+ logging .info ("Detected a developer portal instance..." )
69+ return True
70+ logging .info ("Detected an internal instance..." )
71+ return False
72+
73+
5674def _set_sys_property (property_name : str , value : str ):
5775 """
5876 Set a sys_property in the instance.
@@ -812,9 +830,11 @@ def disable_password_policies():
812830 """
813831 _set_sys_property (property_name = "glide.security.password.policy.enabled" , value = "false" )
814832 _set_sys_property (property_name = "glide.apply.password_policy.on_login" , value = "false" )
815- _set_sys_property (
816- property_name = "glide.authenticate.api.user.reset_password.mandatory" , value = "false"
817- )
833+ # The following is not supported on developer portal instances
834+ if not _is_dev_portal_instance ():
835+ _set_sys_property (
836+ property_name = "glide.authenticate.api.user.reset_password.mandatory" , value = "false"
837+ )
818838 logging .info ("Password policies disabled." )
819839
820840
You can’t perform that action at this time.
0 commit comments