Exemplo n.º 1
0
 public function executeRegisterMobileToRegisterEnd(opWebRequest $request)
 {
     $id = $request->getParameter('id');
     $token = $request->getParameter('token');
     $memberConfig = Doctrine::getTable('MemberConfig')->retrieveByNameAndMemberId('register_mobile_token', $id);
     $this->forward404Unless($memberConfig && $token === $memberConfig->getValue());
     opActivateBehavior::disable();
     $this->form = new opPasswordForm(null, array('member' => $memberConfig->getMember()));
     opActivateBehavior::enable();
     if ($request->isMethod(sfWebRequest::POST)) {
         $this->form->bind($request->getParameter('password'));
         if ($this->form->isValid()) {
             $member = $memberConfig->getMember();
             $pre = Doctrine::getTable('MemberConfig')->retrieveByNameAndMemberId('mobile_address_pre', $id);
             if ($pre) {
                 $member->setConfig('mobile_address', $pre->getValue());
                 $pre->delete();
             }
             $member->setConfig('mobile_uid', $request->getMobileUID(false));
             $this->getUser()->setCurrentAuthMode($memberConfig->getMember()->getConfig('register_auth_mode'));
             $this->getUser()->setMemberId($id);
             $this->redirect($this->getUser()->getRegisterEndAction());
         }
     }
     return sfView::SUCCESS;
 }