public function executeRegister(sfWebRequest $request) { $this->redirectUnless($this->getUser()->isAuthenticated(), "@sf_guard_signin"); $this->form = new OauthRegisterForm(); if ($request->isMethod('post')) { $this->form->bind($request->getParameter('application')); if ($this->form->isValid()) { // The currently logged on user $user_id = $this->getUser()->getGuardUser()->getId(); // This should come from a form filled in by the requesting user $consumer = array('requester_name' => $this->form['name']->getValue(), 'requester_email' => $this->form['email']->getValue(), 'callback_uri' => $this->form['callback_uri']->getValue(), 'application_uri' => $this->form['application_uri']->getValue(), 'application_title' => $this->form['application_title']->getValue(), 'application_descr' => $this->form['application_descr']->getValue(), 'application_notes' => $this->form['application_notes']->getValue(), 'application_type' => $this->form['application_type']->getValue(), 'application_commercial' => $this->form['application_commercial']->getValue()); // Register the consumer $store = oauthSecurityManager::storeInstance(); $key = $store->updateConsumer($consumer, $user_id); // Get the complete consumer from the store $consumer = $store->getConsumer($key, $user_id); // Some interesting fields, the user will need the key and secret $this->consumer = $consumer; $this->consumer_id = $consumer['id']; $this->consumer_key = $consumer['consumer_key']; $this->consumer_secret = $consumer['consumer_secret']; $mailBody = $this->getPartial('mailBody', array('nombre' => $this->getUser()->getProfile()->getNombre(), "consumer" => $consumer)); $mailUser = sfConfig::get('app_mail_user'); VoMail::send(sfContext::getInstance()->getI18N()->__('Datos del registro de tu aplicación'), $mailBody, $this->getUser()->getGuardUser()->getUsername(), array($mailUser => 'no-reply'), true); return 'ShowData'; } } }