(Since this is 4 years old, I’m just making sure there’s no more modern way.)
If, after entering ID & PW, I have to hit the user table to validate the password, it seems very redundant to go through all these steps just to display the UserName on the page.
Why not add another step in the Security user_login API to save the data I need at that time and be done with it?
In my case, At Login, I want an arbitrary field from the user table stored as some kind of global variable. (user level, first name, whatever)
Lets say I’m displaying a Product List. If a particular user is logged in, I want to display my COST on the page, but all other times HIDE the cost.
Ben
since yours was first in the list, I watched and implemented your method.
Login/Logout/User Name/etc. all works fine. NICE video. thx!
So now it would be trivial for me to Show/Hide a DIV based on a simple user field available to me in scUserLoggedIn.
But if a user was on a desktop, it would be easy to use the developer tools and examine the XHR Response and see the true Product Cost of all my items since I’m retrieving them in the Query.
So… next step
If a Manager is logged in, I want my server response to have as one of its fields the ProductCost.
And for a non-manager/non-LoggedInUser, I want to return a 0 in that field so it can’t be seen even if the user uses dev. tools.
Is this a case of TWO almost identical API queries and I dynamically choose one based on user Type?
Or is there a way to dynamically modify the SAME query (like with a CASE statement in the SELECT) to Select a 0 in one case, and ProductCost in the other?
I said all my Login/Out stuff was working, but as soon as I published to my DO Droplet, my Login fails.
I connect to the exact same database for Development and Production because I’m only reading data from the db - I’m not updating anything. No need to have 2 diff. dbs.
So why would the security subsystem fail with a 401 Not Authorized when its hitting the same MSSQL connection from DO, yet work fine from my Mac in testing. (Using the exact same credentials, of course).
Thx for helping Ben.
I figured this would be easy… something like restart DO - or manually refresh 1 file that didn’t get copied.
I’m going to post this under a new thread so its easier to find by someone else who is having the same issue.
I had seen the new thread and have been theorizing what the problem could be. My best guess is that the data is encrypted and without an SSL there is no way for the browser to decrypt the data.