Revision 307

Date:
2013/04/23 15:50:53
Author:
ahitrov
Revision Log:
Credentials support
Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/plugins/session/lib/session/AUTH/FaceBook.pm

     
    144 144 my @plugins = split (/[\ |\t]+/, $state->{plugins});
    145 145 my $name = Encode::encode('utf-8', $info->{name});
    146 146 if ( grep { $_ eq 'users' } @plugins ) {
    147 my $user = $keeper->{users}->get_profile( login => 'facebook:'.$info->{id} );
    147 my $user;
    148 if ( $state->{users}->use_credentials ) {
    149 $user = $keeper->{users}->get_profile( facebook => $info->{id} );
    150 } else {
    151 $user = $keeper->{users}->get_profile( login => 'facebook:'.$info->{id} );
    152 }
    148 153 unless ( ref $user ) {
    149 154 my $user_class = $state->{users}->profile_document_class;
    150 155 $user = $user_class->new( $keeper );
     
    163 168 }
    164 169
    165 170 $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 }
    166 177 } else {
    167 178 my ($prop_ava) = grep { $_->{attr} eq 'avatar' && $_->{type} eq 'image' } $user->structure;
    168 179 if ( ref $prop_ava ) {
  • utf8/plugins/session/lib/session/Session.pm

     
    113 113 $profile = $keeper->{users}->login (
    114 114 $opts{login} ? (login => $opts{login}) : (),
    115 115 $opts{email} ? (email => lc($opts{email})) : (),
    116 $opts{phone} ? (phone => $opts{phone}) : (),
    116 117 passwd => $opts{passwd},
    117 118 );
    118 119 } else {