]>
Commit | Line | Data |
---|---|---|
8d725691 MG |
1 | package Plack::App::Gruntmaster::Auth; |
2 | ||
3 | use 5.014000; | |
4 | use strict; | |
5 | our $VERSION = '5999.000_001'; | |
6 | ||
7 | use parent qw/Plack::Middleware::Auth::Complex/; | |
8 | ||
9 | sub call_register { | |
10 | my ($self, $req) = @_; | |
11 | return $self->bad_request('Parameter too long') if grep { length > 100 } $req->parameters->values; | |
12 | ||
13 | $self->SUPER::call_register($req); | |
14 | } | |
15 | ||
16 | sub create_user { | |
17 | my ($self, $parms) = @_; | |
18 | my %parms = $parms->flatten; | |
19 | my $sth = $self->{dbh}->prepare_cached('INSERT INTO users (id, name, email, phone, town, university, country, level, passphrase) VALUES (?,?,?,?,?,?,?,?,?)'); | |
20 | $sth->execute(@parms{qw/username name email phone town university country level/}, $self->hash_passphrase($parms{password})); | |
21 | } | |
22 | ||
23 | 1; | |
24 | __END__ |