|
|
 |
| FAQs
& Hints |
 |
|
Filter recordset by password after loging in
Category: User Authentication
In many cases we want the user log in only by Username and Password and no levels then filter a recordset against these two elements on the next page, but this looks like not a easy task using the User Authetication server behaviors, because the behavior it will pass only the username in a session named MM_Username and not the password. Still another session is created which is named MM_UserAuthorization or MM_UserGroup in case of the native php sb of MX2004, this can be empty or may hold the level elements.
Now, to achieve the result we want, without the need of adding any extra code to the login block, just follow this procedure:
First of all it must be obvious that a users table must have a unique column, like CustomID, UserID or what ever you like, to uniquely identify the record. Got that just open the Log In User and choose Restrict Access Based On Username, Password, and Access Level, here select just the unique column (i.e., UserID). At this point it will happen that, after the record corresponding to username and password is found, its unique column content it will be passed to the MM_UserAuthorization or MM_UserGroup session.
Of course we still have to set the Restrict Access To Page in the page would be accessed after login.
Open the page and click Restrict Access To Page, ignore what we have done with the Log In User, disable any levels if enabled and choose Restrict Access Based On Username and Password.
Now we have the MM_UserAuthorization or MM_UserGroup session that can catch perfectly the record corresponding to the Username and Password. On the recordset dialog set the filter to the unique column (i.e., UserID) equals to the session variable MM_UserAuthorization or MM_UserGroup. Remember you can use forward this session so long is alive.
You'll see that it would work fine.
This apply also to the DW ASP version. |
|
|
|
|
|
|