First login issue

First login issue

  

Hi all,

i am working on something like CRM to let user login to our portal, and login account is created by admin(that mean me), i just want to force the user to change to password when they are the first time to login.

i created a entity(so call UserMgt) for assigning the role for user and including FirstLogin(boolean type) attribute. The record is created by me after created the login account.

So i will check after the user login the portal if the FirstLogin attribute on UserMgt entity is True for that user, then will direct to ChangePassword page.

then i created a save button with the action  "Createorupdate UserMgt" and assigned the variable of "FirstLogin = False" for updating password and FirstLogin status at the same time. 

The issue is that seems it will create a new record on UserMgt instead of update the record. 

i think that the reason is the systems cannot find the specific record for the user on UserMgt.

Also, i found that actually it is not working for the checking stage , whatever the status of the FirstLogin attribute, it just considered with True and direct to change password page. It may be the same issue.

Below is my logic about the checking stage and UserMgt entity.

  

Hi Chin,

If a new record is being created, it's most likely because you're not correctly assigning a value to UserManagement.Id before calling the CreateOrUpdate method.

Can you show how exactly you're getting the UserManagement record from the database?

Aurelio Junior wrote:

Hi Chin,

If a new record is being created, it's most likely because you're not correctly assigning a value to UserManagement.Id before calling the CreateOrUpdate method.

Can you show how exactly you're getting the UserManagement record from the database?

Hi Aurelio,

Thanks for the quick reply, and below slow the record what i exactly get.

Actually i got many empty record with FirstLogin= false.


Solution

I don't understand this. Aren't you filtering the aggregate that gets the UserManagement record by its UserId attribute?

Solution

Aurelio Junior wrote:

I don't understand this. Aren't you filtering the aggregate that gets the UserManagement record by its UserId attribute?

may be... how can i get the correct UserMgt record by the logged in user? 

now i am set UserManagement.UserId = GetUser(GetUserId()).User.Id, is that right for getting the logged in user record on other table?


Aurelio Junior wrote:

I don't understand this. Aren't you filtering the aggregate that gets the UserManagement record by its UserId attribute?

Hi Aurelio,

Seems i already solved the issue! Thank you very much for your reply and help.