Revision 309
- Date:
- 2013/04/24 11:11:41
- Files:
Legend:
- Added
- Removed
- Modified
-
utf8/plugins/session/comps/www/oauth/autohandler
1 <%init> 2 3 $r->content_type('text/html'); 4 $m->call_next; 5 6 </%init> -
utf8/plugins/session/lib/session/AUTH/FaceBook.pm
147 147 my $user; 148 148 if ( $state->{users}->use_credentials ) { 149 149 $user = $keeper->{users}->get_profile( facebook => $info->{id} ); 150 } else { 150 } 151 unless ( ref $user ) { 151 152 $user = $keeper->{users}->get_profile( login => 'facebook:'.$info->{id} ); 152 153 } 153 154 unless ( ref $user ) { 154 155 my $user_class = $state->{users}->profile_document_class; 155 156 $user = $user_class->new( $keeper ); 157 my %props = map { $_->{attr} => $_ } $user->structure; 156 158 $user->login( 'facebook:'.$info->{id} ); 157 159 $user->name( $name ); 158 160 $user->status( 1 ); 159 161 $user->type( 0 ); 160 162 $user->login_method('facebook'); 161 $user->country( $info->{locale} ); 163 if ( exists $props{country} ) { 164 $user->country( $info->{locale} ); 165 } 162 166 $user->email( undef ); 163 167 164 168 my ($prop_ava) = grep { $_->{attr} eq 'avatar' && $_->{type} eq 'image' } $user->structure; … … 168 172 } 169 173 170 174 $user->store; 171 if ( $state->{users}->use_credentials ) { 172 $user->create_credential( 173 facebook => $info->{id}, 174 avatar => 'https://graph.facebook.com/'.$info->{username}.'/picture?type=large', 175 ); 176 } 177 175 } else { 178 176 my ($prop_ava) = grep { $_->{attr} eq 'avatar' && $_->{type} eq 'image' } $user->structure; 179 177 if ( ref $prop_ava ) { … … 185 183 } 186 184 } 187 185 } 186 if ( $state->{users}->use_credentials ) { 187 $user->create_credential( 188 facebook => $info->{id}, 189 avatar => 'https://graph.facebook.com/'.$info->{username}.'/picture?type=large', 190 ); 191 } 188 192 my %data = ( 189 193 id => $user->id, 190 194 name => $user->name,