How to create a temporary password for User with validity

Hi Everyone,

How to create a temporary password for a user with a vailidty of 24 hours. Beyond the time limit, the temporary password needs to be expired. i.e the user wont be able to access the application page if the password is expired

You can extend users entity by adding expirationDateTime attribute and write logic either in timer for existing logged in user or on login button click on screen.

Hi Saif, 

You can have an attribute in the User Extended entity with the CreationDateTime and IsExired while saving a password in the user entity. When someone accesses the application (logs in), check if the Password CreationDateTime is within 24 hours then allows access, otherwise set IsExpired to true and ask him to set the password.

Hi Mayank,

need to acheive the temporary password using if conditions without timer functions and javascript. Could you suggest alternative

Hi Mayank,

Could you assist me with a demo oml file so that i could understand what you are proposing better..

Hi Saif,

This demo application is created to represent the concept that you are looking for.

Please follow the steps below to test this Demo Application after you have installed it in your environment.

1. Register the user with the Default page of the application.

2. The application will take you to the login page after you have completed the user registration process. Your temporary password, which is only valid for 2 minutes, will be displayed on the Login page itself.

3. If you log in within 2 minutes with the correct username and temporary password, you will be taken to the welcome page; otherwise, you will be notified that your password has expired.

Note: This application is only intended to demonstrate how to check the validity of a password. Obviously, you should check your actual scenario and draw inspiration from it.


Hi Mayank,

tried using the demo appliaction but it is not allowing me to go inside with the temp password.

Could you please double-check that you used the correct Username and Password? This error occurs only when the username does not exist or when you enter the incorrect username and password combination.

Hi Mayank,

tried multiple times with different users creeated. it is not allowing Login...

Hi Mayank, 

the demo module is working .. could you confirm how you have implemented the logic for expiry within 2 mins.. ??

I'm delighted you were able to get the module to work.

Please see the attached image for the login logic in the DoLogin Server action.

My recommendation for better comprehension is to debug the code; once you do, you will be able to grasp everything and adapt the logic to meet your needs.

Hi @saif sheikh,

You can use otp-generator-and-validator component to generate and validate temporary password.

Try :

Thanks, Aadhavan S

Hi Saif Sheikh,

     You can use GeneratePassword Function to achieve temporary password.

Hope this helps you !

Kind Regards,

Pranali Takale

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.