LJ::register_authaction — Registers a secret to have the user validate.


LJ::register_authaction(dbarg, userid, action, arg);


  • dbarg. Deprecated; a master database handle ($dbh) or a master/slave set of database handles ($dbs).

  • userid. Userid of user to register authaction for.

  • action. Action type to register. Max chars: 50.

  • arg. Optional argument to attach to the action. Max chars: 255.


Some things, like requiring a user to validate their email address, require making up a secret, mailing it to the user, then requiring them to give it back (usually in a URL you make for them) to prove they got it. This function creates a secret, attaching what it's for and an optional argument. Background maintenance jobs keep track of cleaning up old unvalidated secrets.




0 if there was an error. Otherwise, a hashref containing keys 'aaid' (the authaction ID) and the 'authcode', a 15 character string of random characters from LJ::make_auth_code.