Revision 845

Date:
2022/11/25 09:46:16
Author:
ahitrov
Revision Log:
Yandex oAuth

Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/plugins/users/lib/users/Init.pm

     
    21 21 users::Section
    22 22
    23 23 users::OA::VK
    24 users::OA::Yandex
    24 25 users::OA::FaceBook
    25 26 users::OA::Google
    26 27 users::OA::Mailru
     
    31 32 push @{ $state->{'available_sections'} }, 'users::Section';
    32 33 if ( $state->{users}->use_credentials ) {
    33 34 push @{ $state->{'available_documents'} },
    34 qw( users::Email users::Phone users::OA::VK users::OA::FaceBook users::OA::Google users::OA::Mailru );
    35 qw( users::Email users::Phone users::OA::VK users::OA::Yandex users::OA::FaceBook users::OA::Google users::OA::Mailru );
    35 36 }
    36 37 0;
    37 38 }
  • utf8/plugins/users/lib/users/Keeper.pm

     
    119 119 # При включенных credentials:
    120 120 # phone => по телефону
    121 121 # vkontakte => по логину ВК
    122 # yandex => по логину Yandex
    122 123 # facebook => по логину Facebook
    123 124 # google => по логину Google
    124 125 # mailru => по логину Mail.ru
     
    168 169 ext_id => delete $opts{vkontakte},
    169 170 limit => 1,
    170 171 );
    172 } elsif ( $opts{yandex} ) {
    173 ($credential) = $keeper->get_documents (
    174 class => 'users::OA::Yandex',
    175 ext_id => delete $opts{yandex},
    176 limit => 1,
    177 );
    171 178 } elsif ( $opts{facebook} ) {
    172 179 ($credential) = $keeper->get_documents (
    173 180 class => 'users::OA::FaceBook',
  • utf8/plugins/users/lib/users/OA/Yandex.pm

     
    1 package users::OA::Yandex;
    2
    3 use base "users::OA::Credential";
    4 use Contenido::Globals;
    5
    6 sub class_name
    7 {
    8 return 'OpenAuth Yandex';
    9 }
    10
    11 sub class_description
    12 {
    13 return 'OpenAuth Yandex';
    14 }
    15
    16 1;
  • utf8/plugins/users/lib/users/UserProfile.pm

     
    9 9 'users::Email' => 'email',
    10 10 'users::Phone' => 'phone',
    11 11 'users::OA::VK' => 'vkontakte',
    12 'users::OA::Yandex' => 'yandex',
    12 13 'users::OA::FaceBook' => 'facebook',
    13 14 'users::OA::Google' => 'google',
    14 15 'users::OA::Mailru' => 'mailru',
     
    18 19 'email' => 'users::Email',
    19 20 'phone' => 'users::Phone',
    20 21 'vkontakte' => 'users::OA::VK',
    22 'yandex' => 'users::OA::Yandex',
    21 23 'facebook' => 'users::OA::FaceBook',
    22 24 'google' => 'users::OA::Google',
    23 25 'mailru' => 'users::OA::Mailru',
     
    291 293 $object->ava_url( $opts{avatar} );
    292 294 $object->store;
    293 295 }
    296 } elsif ( $opts{yandex} ) {
    297 ($object) = $self->keeper->get_documents(
    298 class => 'users::OA::Yandex',
    299 ext_id => $opts{yandex},
    300 limit => 1,
    301 );
    302 return undef if ref $object && $object->uid != $self->id;
    303 unless ( ref $object ) {
    304 $object = users::OA::Yandex->new ($keeper);
    305 $object->name( $opts{name} );
    306 $object->ext_id( $opts{yandex} );
    307 $object->status( 1 );
    308 $object->opaque( $opts{opaque} || 0 );
    309 $object->uid( $self->id );
    310 $object->ava_url( $opts{avatar} );
    311 $object->store;
    312 }
    313 } elsif ( $opts{facebook} ) {
    314 ($object) = $self->keeper->get_documents(
    315 class => 'users::OA::FaceBook',
    316 ext_id => $opts{facebook},
    317 limit => 1,
    318 );
    319 return undef if ref $object && $object->uid != $self->id;
    320 unless ( ref $object ) {
    321 $object = users::OA::FaceBook->new ($keeper);
    322 $object->name( $opts{name} );
    323 $object->ext_id( $opts{facebook} );
    324 $object->status( 1 );
    325 $object->opaque( $opts{opaque} || 0 );
    326 $object->uid( $self->id );
    327 $object->ava_url( $opts{avatar} );
    328 $object->store;
    329 }
    294 330 } elsif ( $opts{google} ) {
    295 331 ($object) = $self->keeper->get_documents(
    296 332 class => 'users::OA::Google',