-base;#'Mojolicious::Plugin::Authentication'
use Mojolicious::Plugin::RoutesAuthDBI::Util qw(json_enc json_dec);
use Mojo::Util qw(decode url_unescape);
#~ use constant PKG => __PACKAGE__;
has [qw
::JSON qw(decode_json encode_json);
#~ use Encode qw(encode decode);
use Mojo::Loader;
use JSON::PP;
my $JSON = JSON::PP->new->utf8(0);
our @EXPORT_OK = qw(json_enc json_dec load_class);
sub json_e
nc {
#~ decode('utf-8', encode_json(shift));
$JSON->encode(shift);
}
sub json_dec {
#~ decode_json(encode('utf-8', shift));
$JSON->decode(shift);
}
sub load_class {
my $class;
if (@_
th;
use Mojo::Base 'Mojolicious::Controller';
use Mojolicious::Plugin::RoutesAuthDBI::Util qw(json_enc json_dec);#load_class
use Hash::Merge qw( merge );
use Digest::MD5 qw(md5_hex);
my ($Init);
has
serinfo',
profile_query => sub {
my ($c, $auth, ) = @_;
{
alt => 'json',
access_token => $auth->{access_token},
};
},
profile_avatar =>'pi
info",
profile_query => sub {
my ($c, $auth, ) = @_;
{
format => 'json',
oauth_token=> $auth->{access_token},
};
},
# "default_avatar_id":
-base;#'Mojolicious::Plugin::Authentication'
use Mojolicious::Plugin::RoutesAuthDBI::Util qw(json_enc json_dec);
has [qw(session_key stash_key app plugin model)];
sub new {
state $self = shift->S
if ( $guest && $guest->{id}) {
my $json = $guest->{data} && json_dec(delete $guest->{data});
@$guest{ keys %$json } = values %$json
if $json;
$self->app->log->debug("Succes
aders->to_hash(1);
$data->{IP} = $c->tx->remote_address;
my $guest = $self->model->store(json_enc($data));
$c->session($self->session_key => $guest->{id});
$c->stash($self->stash_key
;
my $json = $c->req->json;
my ($cookie) = ($json && $json->{cookie})
|| $c->vars('cookie');
unless ($cookie) {
return $c->render(json=>{error=>"No cookie"})
if $json;
|| {error=>"none profile by given cookie [$cookie]"}} };
return $c->render(json=>{profile=>$profile})
if $json;
return $c->render(text=>"Success signed by cookie\n".$c->dumper($profile)