src/AppBundle/Controller/LoginBindController.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace AppBundle\Controller;

use ApiBundle\Api\Resource\Setting\Setting;
use AppBundle\Controller\OAuth2\OAuthUser;
use Biz\Sensitive\Service\SensitiveService;
use Biz\System\SettingException;
use Biz\User\Service\AuthService;
use Biz\User\Service\TokenService;
use Biz\User\Service\UserService;
use AppBundle\Common\SimpleValidator;
use Biz\User\TokenException;
use Symfony\Component\HttpFoundation\Request;
use AppBundle\Component\OAuthClient\OAuthClientFactory;

class LoginBindController extends BaseController
{
    public function indexAction(Request $request, $type)
    {
        if ($request->query->has('_target_path')) {
            $targetPath = $request->query->get('_target_path');
            if ('' == $targetPath) {
                $targetPath = $this->generateUrl('homepage');
            }
            if (!in_array($targetPath, $this->getBlacklist())) {
                $request->getSession()->set('_target_path', $targetPath);
            }
        }
        $client = $this->createOAuthClient($type);

        $token = $this->getTokenService()->makeToken('login.bind', array(
            'data' => array(
                'type' => $type,
                'sessionId' => $request->getSession()->getId(),
            ),
            'times' => $this->isAndroidAndWechat($request) ? 0 : 1,
            'duration' => 3600,
        ));
        $params = array(
            'type' => $type,
            'token' => $token['token'],
        );

        if ($request->query->get('os')) {
            $params['os'] = $request->query->get('os');
        }

        $callbackUrl = $this->generateUrl('login_bind_callback', $params, true);

        $url = $client->getAuthorizeUrl($callbackUrl);

        return $this->redirect($url);
    }

    protected function isAndroidAndWechat($request)
    {
        $userAgent = $this->getWebExtension()->parseUserAgent($request->headers->get('User-Agent'));
        if (!empty($userAgent)
            && !empty($userAgent['os']) && 'Android' == $userAgent['os']['name']

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。