Service portal widget login page

servicenow_devo
Tera Expert

Hi,

 

I need help in configuring and displaying hyperlinks in login page based on user roles.

Eg-in login page there is link to password reset that should be visible to internal users only. Can you guys give an idea to this requirment.

 

Thanks in advance

Thankyou
4 REPLIES 4

Mayur2109
Kilo Sage
Kilo Sage

Hi @servicenow_devo ,

 

You can check in server script if the logged in user has the required role and set flag true and false according to that which can be used in hmtl using ng-if. Refer below sample code.

data.result = false;

if (gs.hasRole("internal user role")){

data.result= true;

}

<div ng-if=data.result>

 

Please check and Mark Helpful and Correct if it really helps you.

Regards,
Mayur Shardul

Hi @Mayur2109 

User has not logged in. This configuration needed to be set up in login page I have checked your code but it's not working and has role is something that works when user logins. And user matchs user table data.

Thankyou

Musab Rasheed
Tera Sage
Tera Sage

Hello,

How you will come to know user has roles when user is not logged in yet ? that's why it is not possible to hide this unless user logs in so follow how it works for Nowlearning/Community site etc.

Please hit like and mark my response as correct if that helps
Regards,
Musab

Vanderlei
Mega Sage

Hello @servicenow_devo , this is impossible because we cannot validate roles for those not logged in yet.

However, you can configure password reset to be valid only for internal users
To do this, make these steps:

1- Search Password Reset > Default Self Service

2- Set the "apply to all users" to false

Vanderlei_0-1698323734606.png

Vanderlei_2-1698323777844.png


3- Create a Group Called Internal Users and add all internal users to this group

 

4- Add this group to the related list


Articles:

Reset a password or unlock a user account with service desk assistance (servicenow.com)

Configure your Password Reset process (servicenow.com)

This is an Out Of The Box functionality 

 

If my answer helped you, please mark my answer as helpful.

 

Vanderlei Catione Junior | LinkedIn

Senior ServicePortal Developer / TechLead at The Cloud People