The need arose for the Login links I've been using to become (in some cases) for one-time use only. Since I thought the approach in http://drupal.org/project/one_time_login was sloppy, I decided to modify the existing loginTicketAPI to support one-time use of the tokens. The strategy is as follows:

1) add a new TINYINT (bool) column to the LoginTicket table - called 'onetime'. Set default to 0, thus preserving the existing behaviour. TRUE/1 here means that the ticket can only be used one, FALSE/0 is the current multiple use state.
2) Alter loginticket_create to accept a 4th parameter (defaults to 0) for 'onetime'.
3) Alter loginticket_login to ask if the ticket's value for 'onetime' is TRUE or FALSE. If TRUE, trigger loginticket_delete after login.
4) Make the corresponding change to loginticket.install to make the DB Column ADD as an update.

I've tested this thoroughly and we have currently deployed. Would like to see this get integrated into the module-proper as I believe this successfully preserves original module functionality while simultaneously adding a feature we had immediate use for. Forgive me for any omissions - new to posting patches to Drupal...

CommentFileSizeAuthor
LoginTicketPatch.patch2.44 KBwrightnow
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

crdant’s picture

Feels like a great addition. Working on getting it commited.

crdant’s picture

Assigned: wrightnow » crdant
Status: Needs review » Fixed

Committed an update that incorporates that gist of the patch with some slight modifications to keep the coding style consistent. Also added and update hook to add the onetime column to the loginticket table.

wrightnow’s picture

Excellent! Glad to see the functionality getting used. Thanks for running with the idea. I note in the update/schema, that your 'onetime' is int vs tinyint, not sure it functionally makes a difference though.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.