src/AppBundle/Controller/PaySecurityController.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Controller;
use AppBundle\Common\SmsToolkit;
use Symfony\Component\HttpFoundation\Request;
class PaySecurityController extends BaseController
{
public function payPasswordAction(Request $request)
{
$user = $this->getCurrentUser();
$hasPayPassword = $this->isPayPasswordSetted($user['id']);
if ($hasPayPassword) {
$this->setFlashMessage('danger', '不能直接设置新支付密码。');
return $this->redirect($this->generateUrl('settings_reset_pay_password'));
}
$form = $this->createFormBuilder()
->add('currentUserLoginPassword', 'password')
->add('newPayPassword', 'password')
->add('confirmPayPassword', 'password')
->getForm();
if ($user->isLogin() && empty($user['password'])) {
$request->getSession()->set('_target_path', $this->generateUrl('settings_pay_password'));
return $this->redirect($this->generateUrl('settings_setup_password'));
}
if ($request->getMethod() === 'POST') {
$form->bind($request);
if ($form->isValid()) {
$passwords = $form->getData();
if ($passwords['confirmPayPassword'] != $passwords['newPayPassword']) {
$this->setFlashMessage('danger', '支付密码错误');
return $this->redirect($this->generateUrl('settings_pay_password'));
}
if (!$this->getAuthService()->checkPassword($user['id'], $passwords['currentUserLoginPassword'])) {
$this->setFlashMessage('danger', '当前用户登录密码不正确,请重试!');
return $this->redirect($this->generateUrl('settings_pay_password'));
} else {
$this->getAccountService()->setPayPassword($user['id'], $passwords['newPayPassword']);
$this->setFlashMessage('success', '新支付密码设置成功,您可以在此重设密码。');
}
return $this->redirect($this->generateUrl('settings_reset_pay_password'));
}
}
return $this->render('settings/pay-password.html.twig', array(
'form' => $form->createView(),
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。