()
| 168 | } |
| 169 | |
| 170 | func (c *QQClient) PasswordLogin() (*LoginResponse, error) { |
| 171 | if c.Online.Load() { |
| 172 | return nil, ErrAlreadyOnline |
| 173 | } |
| 174 | |
| 175 | err := c.connect() |
| 176 | if err != nil { |
| 177 | return nil, err |
| 178 | } |
| 179 | |
| 180 | err = c.keyExchange() |
| 181 | if err != nil { |
| 182 | return nil, err |
| 183 | } |
| 184 | |
| 185 | data, err := buildPasswordLoginRequest(c.Uin, c.Version(), c.Device(), &c.transport.Sig, c.PasswordMD5) |
| 186 | if err != nil { |
| 187 | return nil, err |
| 188 | } |
| 189 | packet, err := c.sendUniPacketAndWait( |
| 190 | "trpc.login.ecdh.EcdhService.SsoNTLoginPasswordLogin", |
| 191 | data, |
| 192 | ) |
| 193 | if err != nil { |
| 194 | return nil, err |
| 195 | } |
| 196 | res, err := parseNtloginResponse(packet, &c.transport.Sig) |
| 197 | if err != nil { |
| 198 | return nil, err |
| 199 | } |
| 200 | if res.Success { |
| 201 | err = c.init() |
| 202 | } |
| 203 | return &res, err |
| 204 | } |
| 205 | |
| 206 | func (c *QQClient) SubmitCaptcha(ticket, randStr, aid string) (*LoginResponse, error) { |
| 207 | c.Sig().CaptchaInfo = [3]string{ticket, randStr, aid} |
no test coverage detected