Using drupal 6 and the 6.x certificate login module I can login just fine. But when using the 7.x-2.0-rc1 with 7.10 or 7.12 I had to fix an issue with the includes/entity.php file which was throwing an error on line 178. I found a fix for that online. But, when I press the submit button for logging in with a certificate it creates the user but it doesn't show me as logged in on the gui interface.
When I try to login again it gives me an error says a duplicate user is being created and won't get past that error unless I login as the administrator and remove the user.
I am using the $_SERVER['SSL_CLIENT_S_DN'] as the user name.
Do you have any suggestions or is anyone else having this issue?
Comments
Comment #1
jpackham commentedComment #2
jpackham commentedChanged Status
Comment #3
jpackham commentedThis is the specific error I was receiving after a clean install of drupal-7.12:
I was able to get past this by changing the following in the certificatelogin.module.
~line 293
Change
$account = user_load(array('username' => $username));To
$account = user_load_by_name($username);That will fix the array_flip error. If you change this alone you will notice the user will create but will not log you in because there is a session issue.
~line 316
Comment out
session_destroy();session_start();
Last but not least, if you want to be able to create an account automatically make sure you uncomment the code that enables account creation from the certificate login admin controls.
It worked for me on both 7.10 and 7.12 so wahlah!
Comment #5
openbrian commentedI ran into exactly the same issue. My dblog was reporting "Notice: A session had already been started - ignoring session_start() in drupal_session_start()". I applied jpackham's patch and now it works correctly. Jordan, thanks for reporting this issue and solving the problem!
After researching and finding the same solution to the "flip" issue, i was still having issues. While the certificate_login_form_submit() function appeared to complete successfully, and dblog reported i had a new session, the resulting page did not display "You have been automatically logged in as %user." It was the session_destroy() and session_start() function calls getting in the way.
Comment #6
zeip commentedSorry for being inactive for so long! I committed the user_load_by_name() fix to VCS.
I was really meaning to remove the functionality to log in with a user name altogether in favour of authmap, but in the just-published release candidate I just changed the default on D7 to authmap.
As for the account creation, I suppose that might be a useful addition, but it's commented out since I haven't tested if it works properly. I should probably try to restore the functionality to the D7 version also...
The session problems might be fixed by another fix that can be found in VCS and 7.x-2.0-rc3. Please try if it works for you and report back, so I know whether to look more into the session thing.
Thanks for your thorough reports!
Comment #7
zeip commentedComment #8
zeip commentedNo further reports about the session problems.