src/AppBundle/Controller/AuthController.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Controller;
use Biz\User\CurrentUser;
use Biz\User\Service\AuthService;
use Biz\User\Service\TokenService;
use Biz\User\Service\UserService;
use Symfony\Component\HttpFoundation\Request;
class AuthController extends BaseController
{
public function emailConfirmAction(Request $request)
{
$token = $this->getTokenService()->verifyToken('email-verify', $request->query->get('token'));
if (empty($token)) {
return $this->render('auth/email-confirm-error.html.twig');
}
$user = $this->getUserService()->getUser($token['userId']);
if (empty($user)) {
return $this->render('auth/email-confirm-error.html.twig');
}
$newEmail = $token['data'];
if (empty($newEmail)) {
return $this->render('auth/email-confirm-error.html.twig');
}
if ($request->getMethod() == 'POST') {
$data = $request->request->all();
$isPasswordOk = $this->getAuthService()->checkPassword($user['id'], $data['password']);
if (!$isPasswordOk) {
$this->setFlashMessage('danger', 'site.incorrect.password');
return $this->redirect($this->generateUrl('auth_email_confirm', array('token' => $token['token'])));
}
$this->getAuthService()->changeEmail($user['id'], $data['password'], $newEmail);
$this->getUserService()->setEmailVerified($user['id']);
$this->getTokenService()->destoryToken($token['token']);
$user['currentIp'] = $this->container->get('request')->getClientIp();
$currentUser = new CurrentUser();
$currentUser->fromArray($user);
$this->switchUser($request, $currentUser);
return $this->redirect($this->generateUrl('homepage'));
}
return $this->render('auth/email-confirm.html.twig', array(
'newEmail' => $newEmail,
));
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。