Not logged in. · Lost password · Register
Forum: General Help and Support Plugins RSS
Authentication with Drupal Accounts
Having a lot of difficulty doing this, what's the best path?
Avatar
bradtem #1
Member for 3 months · 3 posts
Group memberships: Members
Show profile · Link to this post
Subject: Authentication with Drupal Accounts
So I would like to authenticate users using drupal accounts.    There is a plugin, authdrupal7 but I have not been able to get much from it, and turns out it uses old mysql access functions now removed as of PHP7, and there has been a ticket on that for quite some time.

I set up to use authpdo and it's not hard to get that to "work" but there is hash function in the crypthash set to match Drupal's.  Drupal keeps the type of hash in the first 4 chars of the encrypted password, the salt in the next 8 characters, and the result of some number of SHA512 hashes (I think it's 15 of them?) with the number I think derived from the hash type.

Anyway, not something you can do in SQL easily.   The best way might be to write a drupal hash function to add to the set of crypthashes.  But I don't see them when I grep for them -- where are they?

Failing all this, what are some good alternate ways to have a system where users can register for an account, confirm their email address with a link mailed them, and then log on and update their account, change password if they want etc. I was going to let drupal do all that and it made sense to just rely on that system since my site has both drupal 7 and the wiki.
Avatar
schplurtz (Moderator) #2
Member since Nov 2009 · 459 posts · Location: France, Finistère
Group memberships: Global Moderators, Members
Show profile · Link to this post
Hi,

The best way might be to write a drupal hash function to add to the set of crypthashes.  But I don't see them when I grep for them -- where are they?
I'm not sure I understand what you want. If you want to add some code to add drupal crypt method to the set that is already recognised by DW, then take a look at inc/PassHash.class.php. I tried to add drupal crypt in inc/PassHash.class.php but have no mean to test wether it works or not. See the attached file. This is of course horrible and won't survive a DW upgrade.
The author has attached one file to this post:
PassHash.class.php.zip 5.3 kBytes
You have no permission to open this file.
Avatar
bradtem #3
Member for 3 months · 3 posts
Group memberships: Members
Show profile · Link to this post
It worked first try.  I bow humbly to your coding skills.   I now see why I didn't find this section.

It would be worth integrating at some point.  Drupal is of course a very popular CMS, and most notably, all of its wiki modules are of low quality and not well maintained, so drupal sites that want to pair with a wiki are on the looking for something.

Thanks very much.
Avatar
bradtem #4
Member for 3 months · 3 posts
Group memberships: Members
Show profile · Link to this post
To add for those wishing to do this, here are the SQL statements:
$conf['plugin']['authpdo']['select-user'] = 'SELECT  name    AS user
        ,name as name
       ,pass     AS hash
       ,mail
       ,uid
  FROM users
  WHERE name = :user
';
$conf['plugin']['authpdo']['select-user-groups'] = 'SELECT DISTINCT role.name AS "group"
 FROM users AS u, users_roles AS urole, role
   WHERE (:uid = urole.uid AND role.rid = urole.rid )
   OR role.name = "wiki"
';

You must add the usual authpdo config values for dsn, user and pass to match your mysql server.
Avatar
schplurtz (Moderator) #5
Member since Nov 2009 · 459 posts · Location: France, Finistère
Group memberships: Global Moderators, Members
Show profile · Link to this post
In reply to post #3
Quote by bradtem:
It would be worth integrating at some point.  Drupal is of course a very popular CMS, and most notably, all of its wiki modules are of low quality and not well maintained, so drupal sites that want to pair with a wiki are on the looking for something.
Thank you for your feedbacks. Now that it's confirmed it works, I will prepare a pull request on github to integrate this hash method in DW; but I'll have to clean up the code first. Probably next weekend.

Happy DokuWiki
Schplurtz.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-08-21, 07:18:09 (UTC +02:00)