-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
80 lines (61 loc) · 2.07 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
NAME
Catalyst::Plugin::SimpleAuth - Simple authentication for Catalyst
SYNOPSIS
# in your Catalyst application:
use Catalyst qw(SimpleAuth);
__PACKAGE__->config(
simpleauth => { class => 'Users' },
);
# in your sign up code
unless( $c->sign_up(
{ username => $email,
password => $password,
}
) ) {
# sign up failed, user exists
}
my $user = $c->user;
...
# in your sign in code
my $user = $c->user;
if ($c->sign_in(
{ username => $email,
password => $password,
}
)
)
{
my $user = $c->user;
...
} else {
# sign in failed
}
# in your sign out code
$c->sign_out;
DESCRIPTION
This module is a replacement module for Catalyst::Authentication::*
which does one thing and does it well. This module assumes that you have
a model for the users you wish to authenticate - this will typically be
a DBIx::Class module.
You set the name of the model to authenticate in the configuration as
above. 'sign_up' creates the instance for you. 'sign_in' signs a person
in, 'sign_out' signs a person out. You can access the user object either
as $c->user in the code or as the 'user' variable in the stash.
This module saves SHA1 digests of the passwords instead of the password.
The model will generally have a database structure along the lines of:
CREATE TABLE `users` (
`username` text NOT NULL,
`password` char(40) NOT NULL,
`first_name` text,
`last_name` text
);
Note that the password will be 40 characters long.
This module requires either Catalyst::Plugin::Session or
Catalyst::Plugin::CookiedSession.
AUTHOR
Leon Brocard <acme@astray.com>.
COPYRIGHT
Copyright (C) 2008-9, Leon Brocard
LICENSE
This module is free software; you can redistribute it or modify it under
the same terms as Perl itself.