Permalink
Browse files

user_id取れない場合もあるよなね

  • Loading branch information...
1 parent 07107fa commit b9e77c449fa3b8b455aa3d05e587372ebd5ab451 @nekokak committed Feb 26, 2010
Showing with 6 additions and 10 deletions.
  1. +6 −10 lib/Kamui/Plugin/Session/State/MobileAttributeID.pm
@@ -20,18 +20,14 @@ sub get_session_id {
my $self = shift;
my $ma = $self->{c}->mobile;
- if ($ma->can('user_id')) {
- if (my $user_id = $ma->user_id) {
- if ($self->{check_ip}) {
- my $ip = $ENV{REMOTE_ADDR} || $self->{c}->req->address || die "cannot get address";
- if (!$ma->isa_cidr($ip)) {
- die "SECURITY: invalid ip($ip, $ma, $user_id)";
- }
+ if ($ma->can('user_id') and (my $user_id = $ma->user_id)) {
+ if ($self->{check_ip}) {
+ my $ip = $ENV{REMOTE_ADDR} || $self->{c}->req->address || die "cannot get address";
+ if (!$ma->isa_cidr($ip)) {
+ die "SECURITY: invalid ip($ip, $ma, $user_id)";
}
- return $user_id;
- } else {
- die "cannot detect mobile id from $ma";
}
+ return $user_id;
} else {
return '';
}

0 comments on commit b9e77c4

Please sign in to comment.