MKDoc::Auth::Plugin::Remove - Let users remove their own accounts.


MKDoc-Auth documentation Contained in the MKDoc-Auth distribution.

Index


Code Index:

NAME

Top

MKDoc::Auth::Plugin::Remove - Let users remove their own accounts.

SUMMARY

Top

This module lets users delete themselves.

INHERITS FROM

Top

MKDoc::Auth::Plugin::Edit

$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_DELETE_URI_HINT environment variable or by subclassing.

$self->http_post();

Deletes the user and redirects to $self->return_uri().


MKDoc-Auth documentation Contained in the MKDoc-Auth distribution.
package MKDoc::Auth::Plugin::Remove;
use MKDoc::Auth::User;
use strict;
use warnings;
use base qw /MKDoc::Auth::Plugin::Edit/;


sub uri_hint
{
    return $ENV{MKD__AUTH_DELETE_URI_HINT} || 'remove.html';
}


sub http_post
{
    my $self = shift;
    my $req  = $self->request();
    my $obj  = $self->object();
    $obj->delete();

    print $req->redirect ($self->return_uri());
    return 'TERMINATE';
}


1;