Welcome Guest, Not a member yet? Register   Sign In
Community auth: problem with login
#1

Hello to all. I have a problem with login: I read on previous posts but did not find the solution to my problem.
This is debugging
DEBUG - 2017-07-05 00:50:57 ->
 String = Giba
 Password = Mat2101g
 Form_token =
 Token_jar = []

I read that the problem is the form_token, but I did not understand how it is generated ... can you help me?

Thank you
Reply
#2

Have you made customizations to the form? It doesn't appear that you've generated the form open tag correctly, or you'd be posting the token. Also, because you have no tokens in the jar, you've probably screwed up your sessions config.
Reply
#3

Hi skunkbad,
I currently have exactly the same problem with Giba.

I installed Community-Auth a week ago and it worked great, then now when I came back again and this time it does not work anymore. I even tried to re-install 2 times and followed the steps but no luck.
I use the examples form (so no changes at all). Can you tell me how the Form_token and Token_jar are generated, because when I try to inspect the HTML, there is no form_token input.
If possible, can you please take a look at my whole source code? I've been struggling for nearly 2 days but cannot figure out why. Please help.
Reply
#4

There is no magic. If it worked and now it doesn't, I can tell you why. Zip up your files, and include a database dump in /sql. Put it only somewhere where I can download it.

In every case that I have done this for somebody, they're always making some configuration mistakes or something. I'll let you know what I find. Be patient, as the next day is my only day off. (I work 6 days a week).
Reply
#5

Hi skunkbad, how can I contact you? I go to your profile but couldn't find PM or something like that. I'm new user here. THanks.
Reply
#6

(This post was last modified: 07-30-2017, 02:14 AM by Sten. Edit Reason: adding more information )

(07-29-2017, 09:19 PM)skunkbad Wrote: There is no magic. If it worked and now it doesn't, I can tell you why. Zip up your files, and include a database dump in /sql. Put it only somewhere where I can download it.

In every case that I have done this for somebody, they're always making some configuration mistakes or something. I'll let you know what I find. Be patient, as the next day is my only day off. (I work 6 days a week).

Here is the link to my dummy project: http://www.mediafire.com/file/q0ms5yd6fx...y_test.rar
You can access to the login page via http://localhost/rakuyomi/login
I put the sql file in application\third_party\community_auth\sql
I have made some name changes to the Examples folder (Examples -> Auth), but no logic changes at all.

Please have a look. Thanks and regards.

---------------------------------------

UPDATE:

Okay, so after I add the hidden input "login_token" to the "login_form.php", it worked now. But
I still don't understand why it used to work before when I first installed Community-Auth
(at that time I remember I didn't add any input to the example login_form.php), and the default
login_form.php file does not come with login_token out-of-the-box.
That's the first thing.

The second thing is,
I'm now encounting another the issue, that is when I set 
$autoload['libraries'] = array('session') in autoload.php, I keep getting this error message when trying to login:


Code:
A Database Error Occurred
Error Number: 1048
Column 'id' cannot be null
INSERT INTO `auth_sessions` (`id`, `user_id`, `login_time`, `ip_address`, `user_agent`) VALUES (NULL, '1', '2017-07-30 10:54:29', '::1', 'Chrome 59.0.3071.115 on Windows 10')
Filename: C:/xampp/htdocs/rakuyomi/system/database/DB_driver.php
Line Number: 691 


And if I stick the "Remember Me" checkbox, I get the above error plus a new one:

Code:
A PHP Error was encountered

Severity: Warning

Message: setcookie() expects parameter 3 to be integer, float given

Filename: core/MY_Input.php

Line Number: 116

Backtrace:

File: C:\xampp\htdocs\rakuyomi\application\core\MY_Input.php
Line: 116
Function: setcookie

File: C:\xampp\htdocs\rakuyomi\application\third_party\community_auth\libraries\Authentication.php
Line: 677
Function: set_cookie

File: C:\xampp\htdocs\rakuyomi\application\third_party\community_auth\libraries\Authentication.php
Line: 280
Function: maintain_state

File: C:\xampp\htdocs\rakuyomi\application\third_party\community_auth\libraries\Authentication.php
Line: 204
Function: login

File: C:\xampp\htdocs\rakuyomi\application\third_party\community_auth\core\Auth_Controller.php
Line: 169
Function: user_status

File: C:\xampp\htdocs\rakuyomi\application\controllers\Auth.php
Line: 295
Function: require_min_level

File: C:\xampp\htdocs\rakuyomi\index.php
Line: 315
Function: require_once

Not sure if any other configurations affected, but you can reproduce with my dummy project above.
Is there a conflict of session library from the CI and the Community-Auth ?
Reply
#7

First, I cannot be reached via private message (PM). All support should be open and public, so that other people can learn from your mistakes. I have not yet looked at your files, because you added more information, and it looks like we might be able to get somewhere without me doing that.

The hidden input for the login token is added in MY_form_helper.php, in the function form_open. If you use form_open, it should automatically add the hidden input for you. This is also the case with CI's CSRF token, which is why I added the token to the form_open function. If you create your form open tag in some other fashion, then you have to manually add the token.

Sessions are already "autoloaded" for you if you use Community Auth. This is done in core/Auth_Controller.php. It is done in the _load_dependencies method. So if your controllers extend MY_Controller, which then extends Auth_Controller, sessions are already autoloaded. So, your controllers should begin with:


PHP Code:
class <Your class name> extends MY_Controller 

So, please do not attempt to autoload the sessions, unless you are generating pages that will not be using Community Auth.

Make those changes and test everything. If you still have problems then put a fresh copy of your files/DB in the download, and let me know.
Reply
#8

(07-30-2017, 08:51 AM)skunkbad Wrote: First, I cannot be reached via private message (PM). All support should be open and public, so that other people can learn from your mistakes. I have not yet looked at your files, because you added more information, and it looks like we might be able to get somewhere without me doing that.

The hidden input for the login token is added in MY_form_helper.php, in the function form_open. If you use form_open, it should automatically add the hidden input for you. This is also the case with CI's CSRF token, which is why I added the token to the form_open function. If you create your form open tag in some other fashion, then you have to manually add the token.

Sessions are already "autoloaded" for you if you use Community Auth. This is done in core/Auth_Controller.php. It is done in the _load_dependencies method. So if your controllers extend MY_Controller, which then extends Auth_Controller, sessions are already autoloaded. So, your controllers should begin with:


PHP Code:
class <Your class name> extends MY_Controller 

So, please do not attempt to autoload the sessions, unless you are generating pages that will not be using Community Auth.

Make those changes and test everything. If you still have problems then put a fresh copy of your files/DB in the download, and let me know.

Thank you very much for the information, I didn't know that my controllers should extends MY_Controller instead of CI_Controller to fully use Community-Auth until I read your post. Removing the session from the CI autoload made the code working again.

Again, thank for the great support.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB