NAME

MKDoc::Auth::Plugin::Confirm - Let users confirm their accounts.

SUMMARY

Once a user has been through MKDoc::Auth::Plugin::Signup, they are sent an email which contains an activation / confirmation link. The link should point to this plugin.

The link has the following form:

http://<SERVER_NAME>/~<login>/.confirm.html?<confirm_nb>

MKDoc::Auth::Plugin::Confirm loads the MKDoc::Auth::TempUser which matches <login> and invokes this object confirm() method with the <confirm_nb> which is contained in the confirmation link.

If the MKDoc::Auth::TempUser confirm_nb matches the user supplied confirm_nb, the MKDoc::Auth::TempUser becomes a regular MKDoc::Auth::User, which activates / confirms the account.

INHERITS FROM

MKDoc::Core::Plugin

API

$self->activate();

Returns 1 only if the PATH_INFO looks like /~<login>/.confirm.html, and <login> is an existing user (wether this user is temporary or not).

$self->uri_hint();

Helps deciding what the URI of this plugin should be.

By default, returns 'confirm.html'.

Can be overriden by setting the MKD__AUTH_CONFIRM_URI_HINT environment variable or by subclassing.

$self->http_get();

Processes this request. Attempts to confirm the current user with the supplied confirmation number, if any.

TEMPLATE METHODS

self/uri [ --object some/object ]

Returns the URI of this plugin.

Since this plugin deals with multiple users, it can have multiple URIs.

If this plugin has been invoked by the current request, it will extract its associated user from the current request.

However if this plugin object has been instanciated by another plugin, then the associated object has to be supplied to this method as follows:

my $user = get_some_user();
my $confirm_p = MKDoc::Auth::Plugin::Confirm->new();
print $confirm_p->uri (object => $user);

Of course this can be done from the template, typically to display the confirmation link URI.

<pre petal:content="confirm_plugin/uri --object self/object">ACTIVATE_URI</pre>

self/object

Returns the data object (a MKDoc::Auth::User or MKDoc::Auth::TempUser object) associated with this plugin.

self/is_active

Returns TRUE if this account is already active, false otherwise.