• vkontakte.html

    280 281  
    21 21 use session::AUTH::VKontakte;
    22 22 my $site = $state->development ? 'www' : 'www';
    23 23 my $vk_connect = session::AUTH::VKontakte->new(
    24 vk_redirect_uri => 'http://'.$site.'/auth/vkontakte.html',
    24 vk_redirect_uri => 'http://'.$site.'/oauth/vkontakte.html',
    25 25 );
    26 26
    27 27
     
    45 45 my $auth_url = $vk_connect->authorize_url;
    46 46 if ( $code ) {
    47 47 my $local_session = $vk_connect->authenticate( code => $code );
    48 if ( ref $local_session && exists $local_session->{id} ) {
    48 if ( ref $local_session eq 'session::Session' && $local_session->id ) {
    49 49 my $profile = $keeper->{users}->get_profile( id => $local_session->{id} ) if exists $keeper->{users};
    50 50 if ( ref $profile ) {
    51 51 unless ( exists $local_session->{avatar} ) {
    52 52 my $avatar = $profile->get_image('avatar');
    53 53 $session->{avatar} = ref $avatar && exists $avatar->{filename} ? $avatar->{mini}{'54x54'}{filename} : undef;
    54 $keeper->{session}->store_value (
    54 $local_session->set (
    55 55 name => $profile->name_full,
    56 56 last_name => $profile->name_family,
    57 57 first_name => $profile->name_part,
    58 58 avatar => $session->{avatar},
    59 59 );
    60 60 } else {
    61 $keeper->{session}->store_value (
    61 $local_session->set (
    62 62 name => $profile->name_full,
    63 63 last_name => $profile->name_family,
    64 64 first_name => $profile->name_part,