#1
Hello, hope y'all are doing well.
I am having a perplexing issue...
Here are the pertinent functions...


Notice the VAR_DUMP at the top of submit login.
And it shows, that the value of "remember" is null, whether I check the box or not.


It matters NOT whether I check the box, the value of "remember" remains the same. The form doesn't seem to be posting the value of the checkbox.
Any ideas?
#2
Here is where you should look.
'remember' => string '' (length=0)
length should be 1

Dan
#3
Thanks,
Apparently, if a checkbox is not checked, it won't get posted.
I believe that is standard PHP behavior. I didn't know.

It turns out that the DAVCON in his 3-part Private Members Area series, uses the "remember" checkbox as follows:

Well, in that example, When I checked the box, and had some other validation error, it came back unchecked, and I would have to check the box again.
I checked the box, but it just wouldn't stay checked.
It turns out that the following... works the way I intended.


BTW, the callback_login_check, in the tutorial video, because it is a validation rule of the username, the validation_errors method will potentially return an error message concerning invalid credentials, prior to checking whether the required password was even entered.
The callback_login_check is premature.

I found that I can alleviate this situation by removing the callback from the "username" validation rules, do the password validation rule first. Then, if there are values in both the posted username and password, then make a second pass of the username with only the callback function as a validation rule. Actually, the only real purpose of not calling the login_check as a stand alone function call after the validation run returns error free, is to make use of the validation_errors handling.

THANK YOU,
T'was a fun filled day of digging threw Trongate code.
#4
Hi Charles,

I've been leaving things for Dan and others to answer questions...

While video tutorials are great for the visually inclined, they date quickly and in my opinion nothing beats working code examples.

Your query on the checkbox issues you have been having is curious, as I see a returned selected checkbox as from $_POST and as you pointed out, is omitted when not checked - standard PHP form handling.

If you look at the view_file from the 'Simple Members' module and not the video tutorial you will seefor the 'Remember Me' checkbox.

the callback logic in the 'Simple Members' module works well
#5
DaFa,
Thank you for reaffirming that I'm not losing my mind.
We're on the same page over the checkbox.

I don't doubt that the login callback works, but it is invoked before the validation rule "required" is checked for the password.
I realize that all of this is a matter of personal preference; no need to follow along blindly. But in this instance, are you saying that the "required" validation rule for the password is superfluous, and instead just check the login credentials in the callback? Which is fine.
I was attempting to remove the possibility that that validation errors don't say "Your credentials are incorrect" before also saying that the "Password is required".