Changeset 9907 for lang/perl/Chaostr
- Timestamp:
- 04/19/08 21:45:19 (5 years ago)
- Location:
- lang/perl/Chaostr/trunk
- Files:
-
- 2 modified
-
Makefile.PL (modified) (1 diff)
-
lib/Chaostr/Web/Controller/Login.pm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Chaostr/trunk/Makefile.PL
r9016 r9907 8 8 requires 'Catalyst::Plugin::Static::Simple'; 9 9 requires 'Catalyst::Action::RenderView'; 10 requires 'Catalyst::Plugin::Session::DynamicExpiry'; 10 11 requires 'Tset::Spelling' => 0; 11 12 requires 'YAML'; # This should reflect the config file format you've chosen -
lang/perl/Chaostr/trunk/lib/Chaostr/Web/Controller/Login.pm
r9278 r9907 30 30 return if $c->req->method eq 'GET'; 31 31 32 33 $c->form({34 required => [qw/username password/]35 } );32 $c->form( { 33 required => [qw/username password/] , 34 optional => [qw/auto/], 35 } ); 36 36 37 37 my $v = $c->form->valid; 38 38 39 $c->log->debug( $v ); 40 41 return if $c->form->has_error; 39 return if $c->form->has_error; 42 40 43 41 $c->authenticate( … … 47 45 ); 48 46 49 if ( !$c->user_exists ) { 50 # ログインできてなかった場合 51 } 47 # ログインできてなかった場合 48 return if !$c->user_exists ; 52 49 53 if ( $c->req->param('auto') ) { 50 # 自動ログイン。セッションを長生きさせる。 51 if ( $v->{'auto'} ) { 54 52 $c->session->{auto_login} = 1; 55 56 53 # 2 週間 57 $c->session_time_to_live( 1_209_600);54 $c->session_time_to_live(1_209_600); 58 55 } 59 56 else { … … 62 59 63 60 $c->log->info( $c->user->name . '(' . $c->req->address . ') logined' ); 61 64 62 $c->model('DBIC::Users')->find( $c->user->id ) 65 63 ->update( { lastlogin_at => $c->datetime() } ); 66 64 65 # 明示的にセッションを保存 66 $c->finalize_session; 67 67 return $c->res->redirect( $c->uri_for(q{/}) ); 68 68 } … … 79 79 $c->delete_session; 80 80 $c->logout; 81 # 明示的にセッションを保存 82 $c->finalize_session; 81 83 } 82 84 … … 87 89 88 90 Daisuke Komatsu C<< <taro __at__ cpan.org> >> 91 92 Tomohiro Teranishi <tomohiro.teranishi@gmail.com> 89 93 90 94 =head1 LICENSE
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)