checkPwdPolicy(code: PP.Mb.FaultCodes);
code. SoapFault server error code.
The checkPwdPolicy method checks if the password meets security policy requirements.
The method returns True if the password meets security policy requirements, and False if otherwise.
Executing the example requires a opened login page of Foresight Analytics Platform web application. The scenario specified below must be executed in the browser console.
Throw a system login error, process it, by showing a notification of this error on the page, and an appropriate notice in the login dialog box:
// Get system login dialog box var loginForm = PP.App.getModuleObject(); // Determine error handler var onMetabaseError = function (sender, args) { var fault = { Code: PP.Mb.FaultCodes.None, Message: "System login error", Detail: "Check user name and password" }; if (args.ResponseText != undefined) { fault = PP.Mb.FaultParser.parse (args.ResponseText); }; if (!loginForm.checkPwdPolicy(fault.Code)) { PP.App.MessageInfo.showFault(fault); }; console.log("test"); // Specify common error PP.App.getModuleObject().getReportBox().getLoginForm().setError( "System login error"); }; // Get repository configuration var metabaseConfig = loginForm.getMetabaseConfig(loginForm); // Handle error metabaseConfig.Error = new PP.Delegate(onMetabaseError); var responseText = "{ \"Fault\": { " + "\"faultcode\": \"soapenv:Sender\", " + "\"faultstring\": \"System login error\", " + "\"detail\": { \"Error\": { \"Message\": \"Password must include different characters\", " + "\"Code\": " + PP.Mb.FaultCodes.KE_SOM_PWD_CHARSDIF + ", \"StackTrace\": \"\" } } } }"; // Call the Error event metabaseConfig.Error.fire(this, { ResponseText: responseText });
After executing the example the window that contains description of system login error appears. After the Details button is clicked, this dialog box looks as follows:
The notification "System login error" also appears in the login box of Foresight Analytics Platform web application.
See also: