one time password for new Users

DB1
Tera Contributor

Hi All,

I am looking for some help where the requirement is as follows:

1. New User should be created via catalog - This is done and working

2. Notification should be sent to user with a One time password and forcing them to reset the password momentarily while this OTP is entered.

Look forward for the help. TIA

 

1 ACCEPTED SOLUTION

Hi @DB 

Is your issue resolved?


Feel free to mark correct, if your issue has been resolved, so it ends up in solved queue.

Will be helpful for others looking for the similar query.

Best Regards
Aman Kumar

View solution in original post

14 REPLIES 14

DB1
Tera Contributor

BR condition is email is not empty.

Also, I am trying this in my PDI

There is a button available OOB to generate a password and it generates as

something like below

.X,o=Xg&]ic}bQWN{PTV=XZfd#_D,JT@4_[N=u.qDYHtVWs0>#z%aqxd%I^!aBsc:$3JD#j

and manual logging not working

This is the encrypted version, I would suggest set the password manually, eventually it will be encrypted, don't worry about it, bring password field on the for, set password as Test@1234, and save the form, now try with userid and this password.

Best Regards
Aman Kumar

DB1
Tera Contributor

Hi Aman, I was able to update the script as below. The gs.log displays the actual password

I need help with taking this value from the log to notification. Can someone please help me how to get this value displayed there?

I am also attaching the notification script

 

template.print("1) Browse to https://" + gs.getProperty("instance_name") + ".service-now.com\n");
  template.print("2) Enter your credentials\n");
  template.print("User ID: "+current.user_name+"\n");
  template.print("Password: "+current.user_password+"\n");

(function executeRule(current, previous /*null when async*/ ) {

	//var randomstring = 'Snow@123';
	var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
    var string_length = 8;
    var randomstring = '';

    for (var j = 0; j < string_length; j++) {
		var rnum = Math.floor(Math.random() * chars.length);

		randomstring += chars.substring(rnum, rnum + 1);
	}
	
	gs.eventQueue("user.password", current, randomstring, current.email);
    
	current.user_password.setDisplayValue(randomstring);
	gs.log("pssw "+randomstring);
	current.password_needs_reset = true;
	current.update();
})(current, previous);

Hi @DB 

You are almost there, you don't need to pass anything else to the notification:

template.print("1) Browse to https://" + gs.getProperty("instance_name") + ".service-now.com\n");
template.print("2) Enter your credentials\n");
template.print("User ID: "+current.user_name+"\n");
template.print("Password: "+event.parm1+"\n");// since you are already passing it in eventQueue function as 

	gs.eventQueue("user.password", current, randomstring, current.email);


Feel free to mark correct, if your issue has been resolved, so it ends up in solved queue.

Will be helpful for others looking for the similar query.

 

Best Regards
Aman Kumar

Hi @DB 

Is your issue resolved?


Feel free to mark correct, if your issue has been resolved, so it ends up in solved queue.

Will be helpful for others looking for the similar query.

Best Regards
Aman Kumar