File Coverage

blib/lib/Mojo/Webqq/Client/Remote/_check_verify_code.pm
Criterion Covered Total %
statement 0 16 0.0
branch 0 16 0.0
condition n/a
subroutine 0 1 0.0
pod n/a
total 0 33 0.0


line stmt bran cond sub pod time code
1             sub Mojo::Webqq::Client::_check_verify_code{
2 0     0     my $self = shift;
3 0 0         return 1 if $self->login_type eq "qrlogin";
4 0 0         $self->info("检查验证码...") if $self->login_type eq "login";
5 0           my $api_url = 'https://ssl.ptlogin2.qq.com/check';
6 0           my $headers = {Referer=>'https://xui.ptlogin2.qq.com/cgi-bin/xlogin?daid=164&target=self&style=40&pt_disable_pwd=1&mibao_css=m_webqq&appid=501004106&enable_qlogin=0&no_verifyimg=1&s_url=http%3A%2F%2F' . $seld->domain . '%2Fproxy.html&f_url=loginerroralert&strong_login=1&login_state=10&t=20131024001'};
7              
8 0 0         my @query_string = (
9             regmaster => '',
10             pt_tea => ($self->login_type eq "qrlogin"?2:1),
11             pt_vcode => 1,
12             uin => $self->account,
13             appid => 501004106,
14             js_ver => 10233,
15             js_type => 1,
16             login_sig => $self->pt_login_sig,
17             u1 => 'http%3A%2F%2F' . $self->domain . ' %2Fproxy.html',
18             r => rand(),
19             pt_uistyle => 40,
20             pt_jstoken => 485008785,
21             );
22            
23             #$self->ua->cookie_jar->add(
24             # Mojo::Cookie::Response->new(
25             # name => "chkuin",
26             # value => $self->uid,
27             # domain => "ptlogin2.qq.com",
28             # path => "/",
29             # )
30             #);
31 0           my $content = $self->http_get($self->gen_url($api_url,@query_string),$headers);
32 0 0         return 0 unless defined $content;
33 0           my %d = ();
34 0           @d{qw( retcode cap_cd md5_salt ptvfsession isRandSalt)} = $content=~/'(.*?)'/g ;
35             $self->md5_salt($d{md5_salt})
36             ->cap_cd($d{cap_cd})
37             ->isRandSalt($d{isRandSalt})
38 0           ->pt_verifysession($d{ptvfsession});
39 0 0         if($d{retcode} ==0){
    0          
40 0 0         $self->info("检查结果: 很幸运,本次登录不需要验证码") if $self->login_type eq "login";
41 0           $self->verifycode($d{cap_cd});
42             }
43             elsif($d{retcode} == 1){
44 0 0         $self->info("检查结果: 需要输入图片验证码")->is_need_img_verifycode(1) if $self->login_type eq "login";
45             }
46 0           return 1;
47             }
48             1;