Closed (fixed)
Project:
Google Authenticator login
Version:
7.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Mar 2013 at 10:11 UTC
Updated:
25 Sep 2013 at 09:21 UTC
Jump to comment: Most recent file
Comments
Comment #1
attiks commentedGood idea, can you provide a patch?
Comment #2
K.MacKenzie commentedI actually have this working within a custom module (and built into a very custom user interface).
I would be happy to incorporate my change into the contrib module and contribute a patch, but how do you see the best way to implement this in the user interface?
I was thinking a checkbox on the user/edit page
[ ] Delete this users GA Login code
Then it would just do a simple db_delete('ga_login')->conditions('username', $username)->execute(); and push a drupal_set_message on form submit.
What do you think, Attiks?
Comment #3
attiks commentedUX wise I think a button would be better, combined with a confirmation page. Ideally we would go through the ga class to handle the delete, but not sure if it's supported.
Patches are very welcome
Comment #4
K.MacKenzie commentedI would agree that going through the ga class to handle the delete is the best route, the function itself would need to be added to the class though because there isn't one currently.
The button/confirmation sounds good too, my only trouble now is finding the time to do this. Hopefully next weekend.
Cheers,
Comment #5
K.MacKenzie commentedHey,
Sorry it took me so long.
I have never installed a confirmation form through hook_form_alter before and I ran into a weird snag trying to set up the confirmation form as a switch within the main form; the submit wouldn't call my custom function. To work around this I simply made a new page and form and redirected to that. Attiks, if you know of a better way I would be really interested to hear it, but I think this will suffice just fine.
Notice that in order for this to work the user needs either delete own code permission or delete others code permission.
Also, I didn't put the delete function inside the ga_login class because I didn't understand the benefit and I wasn't sure if this is what you meant. If you think the function should be inside the class rather than the module file let me know and I will update the patch.
Here is the patch.
Comment #6
attiks commentedThanks for the patch, I made some minor changes