NAME
MKDoc::Auth::Plugin::Edit - Let users edit their own accounts.
SUMMARY
This module lets users edit their account details, i.e. first name, email address and password.
INHERITS FROM
$self->activate();
If the URI looks like /~<login>/.edit.html, and <login> is the same as the current user in $::MKD_USER, returns TRUE.
Otherwise, returns FALSE.
$self->uri_hint();
Helps deciding what the URI of this plugin should be.
By default, returns 'edit.html'.
Can be overriden by setting the MKD__AUTH_EDIT_URI_HINT environment variable or by subclassing.
$self->http_get();
Displays a web form which lets the user change their user details.
$self->http_post();
Processes the web form which was displayed by $self->http_get().
If there were errors processing the form, re-display $self->http_get().
If the modification was successful, redirects to $self->return_uri().
TEMPLATE METHODS
$self->return_uri();
The return URI of this module, i.e. where should we go once we're done.
$self->uri();
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 $edit_p = MKDoc::Auth::Plugin::Edit->new();
print $edit_p->uri (object => $user);
Of course this can be done from the template, typically to construct a link for the user to edit his account if he so wishes.
<!--? assuming that the current user is returned by self/object ?-->
<a href="#"
petal:define="edit_p plugin: MKDoc::Auth::Plugin::Edit"
petal:attributes="href edit_p/uri --object self/object">Edit Account Info</a>
self/object
Return the current MKDoc::Auth::User object.