42
Views
14
Comments
Solved
How to pass user id to popup widget?

Hi community! Is there a way to pass user id to popup widget? I'm going to implement a mandatory change password through popup widget inside login screen where user will be forced to change password if their current password is !@default123.

However after logging in the current user id or current username wasn't fetch through this disable input widget. 

Here's my current code inside login screen. I will also provide my oml file

BulkUserProcessing.oml
Solution

Hi @Izumi-kun 

For security, you should move the default password check to the server side, This way People can't see the default password in the javascript, and try to hack into default password users. You can also get the userId after the login from the server side and return this to the client side.

See my OML

UpdatedBulkUserProcessing.oml

Thanks man!

If you have any further questions, reply to this post; I will be pleased to answer them!

Do you have an idea on how can I put a restrictions that after changing a password if the user click the return button in chrome tab if his/her password is already been changed it should redirected to their designated screen but if their password is still the default pass the popup should appear again. I'll truly appreciate your response man!

What you could try is to create an extended entity of User and add a property "PasswordChangeRequired", When it's true the user should be redirected to a password change screen otherwise send them to the correct screen.

Hi! Have you tried this

??

Regards

Graça

Have you tried refreshing your aggregate after assigning value to the GetUserId?

I did not try where should I refresh an aggregate? Inside the login client action?

Oh this actually works thank you. But may I ask? Does my method to check if password is default is correct? Or should I use ValidatePassword server action? But I didn't know how to implement this action😅

That's another way. 

yes in Inside the login client action after  GetUserId

Hi @Izumi-kun

Just need to change login in client action flow you have to check the password before log in as I shown in the screenshot and you want the username in the input box of current user then just pass the local variable of username i.e. shown in the screenshot and I have also attached the updated OML just for your reference.

Asad


UpdatedBulkUserProcessing.oml

Hi @Asad Sheikh 

You have to do the check after the login action. This code create a security flaw, where if you put the default paswword for any user, you can change the password for this user without validating there current password first. 

Should I use ValidatePassword server action?

Solution

Hi @Izumi-kun 

For security, you should move the default password check to the server side, This way People can't see the default password in the javascript, and try to hack into default password users. You can also get the userId after the login from the server side and return this to the client side.

See my OML

UpdatedBulkUserProcessing.oml

Thanks man!

If you have any further questions, reply to this post; I will be pleased to answer them!

Do you have an idea on how can I put a restrictions that after changing a password if the user click the return button in chrome tab if his/her password is already been changed it should redirected to their designated screen but if their password is still the default pass the popup should appear again. I'll truly appreciate your response man!

What you could try is to create an extended entity of User and add a property "PasswordChangeRequired", When it's true the user should be redirected to a password change screen otherwise send them to the correct screen.

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