Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if($c->treat_data('Login','login',$params) ){
- eval{
- say "email: $email";
- say "password: $password";
- $auth = $c->authenticate( { email => $email,
- passwd => $password,
- },
- );
- };
- if($@){
- $c->stash->{error} = q/Can't login!/;
- $c->stash->{status_code} = 500;
- say "LOGIN ERROR: $@";
- }
- elsif(!$auth){
- $c->stash->{error} = q/User or password invalid!/;
- $c->stash->{status_code} = 401;
- }
- else {
- use DDP;
- say "CONTEXT: " . p $c;
- say "USER_EXISTS: " . p $c->user_exists;
- say "USER: " . p $c->user if $c->user_exists;R
- say "SESSION: " . p $c->session if $c->session;
- $c->stash->{'access-key'} = $self->create_access_key($c);
- }
- }
- #### Config do plugin Authentication
- 'Plugin::Authentication' => {
- default_realm => 'members',
- members => {
- credential => {
- class => 'Password',
- password_field => 'passwd',
- # password_type => 'clear',
- password_type => 'hashed',
- password_hash_type => 'SHA-1',
- },
- store => {
- class => 'DBIx::Class',
- user_model => 'APIDB::Account',
- role_column => 'roles',
- }
- }
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement