- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2020 07:07 AM
I have customized installation exit to modify the error message for failed login attempt. It is working as expected in the main console, but service portal login still displays old message.
Main console:
Service Portal:
I have verified that the new installation exit is invoked for service portal login, but message is incorrect. I would like to display different messages based on account locked_out status. Please assist.
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2020 11:43 PM
I was able to fix the issue by adding custom code to server script:
if(input.flag == "true") {
var gr = new GlideRecord("sys_user");
gr.addQuery('user_name', input.username);
gr.query();
if(gr.next()) {
if(gr.locked_out) {
data.customMsg = gs.getMessage("crt_account_locked");
//input.username = '';
}
else {
data.customMsg = gs.getMessage("login_invalid");
}
}
else {
data.customMsg = gs.getMessage("login_invalid");
}
return;
}
Modified the client script as per the screenshot shared by Naveen, but with little more customization:
else {
// wrong username or password
/*c.message = response.data.message;
c.password = "";
c.username = "";*/
c.data.flag = "true";
c.server.update().then(function() {
c.message = c.data.customMsg;
c.password = "";
c.data.username = "";
});
angular.element("#username").focus();
}
Finally add .data to ng-model of username in HTML: ng-model="c.data.username"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2020 07:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2020 04:59 AM
I would like to display messages based on locked out state. Any idea how that can be accomplished?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2020 05:16 AM
The same message comes up even when the account is locked out. No separate message is coming from the api.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2020 11:43 PM
I was able to fix the issue by adding custom code to server script:
if(input.flag == "true") {
var gr = new GlideRecord("sys_user");
gr.addQuery('user_name', input.username);
gr.query();
if(gr.next()) {
if(gr.locked_out) {
data.customMsg = gs.getMessage("crt_account_locked");
//input.username = '';
}
else {
data.customMsg = gs.getMessage("login_invalid");
}
}
else {
data.customMsg = gs.getMessage("login_invalid");
}
return;
}
Modified the client script as per the screenshot shared by Naveen, but with little more customization:
else {
// wrong username or password
/*c.message = response.data.message;
c.password = "";
c.username = "";*/
c.data.flag = "true";
c.server.update().then(function() {
c.message = c.data.customMsg;
c.password = "";
c.data.username = "";
});
angular.element("#username").focus();
}
Finally add .data to ng-model of username in HTML: ng-model="c.data.username"