public function loginAction()
 {
     $loginForm = new Form_Login();
     $resetForm = new Form_ResetPassword();
     $request = $this->getRequest();
     if ($request->isPost()) {
         $loginForm->isValid($request->getPost());
         $adapter = new Infra_AuthAdapter($request->getPost('email'), $request->getPost('password'), $request->getPost('timezone_offset'));
         //$adapter = new Zend_Auth_Adapter_DbTable($zendDb);
         $auth = Infra_AuthHelper::getAuthInstance();
         $result = $auth->authenticate($adapter);
         if ($result->isValid()) {
             // Zend_Session::getSaveHandler()->write(uniqid(), $result->getIdentity());
             if ($request->getPost('remember_me')) {
                 Zend_Session::rememberMe(60 * 60 * 24 * 7);
             }
             // 1 week
             $nextUri = $this->_getParam('next_uri');
             KalturaLog::debug("next uri {$nextUri}");
             if ($nextUri && strlen($nextUri) > 1) {
                 $this->_helper->redirector->gotoUrl($nextUri);
             } else {
                 $this->_helper->redirector('list-by-user', 'partner');
             }
         } else {
             $loginForm->setDescription('invalid login');
         }
     }
     $loginForm->setDefault('next_uri', $this->_getParam('next_uri'));
     // set in Infra_AuthPlugin
     $this->view->loginForm = $loginForm;
     $this->view->resetForm = $resetForm;
     $this->render('login');
 }
Ejemplo n.º 2
0
 public function loginAction()
 {
     $loginForm = new Form_Login();
     $resetForm = new Form_ResetPassword();
     $request = $this->getRequest();
     if ($request->isPost()) {
         $loginForm->isValid($request->getPost());
         $adapter = new Kaltura_AdminAuthAdapter();
         $adapter->setPrivileges('disableentitlement');
         $safeEmailFieldValue = strip_Tags($request->getPost('email'));
         // Strip HTML Tags to prevent a potential XSS attack
         $passwordFieldValue = $request->getPost('password');
         // DO NOT strip 'password' HTML Tags in order not to invalidate passwords (e.g. "<b>BoldPassword</b>")
         $adapter->setCredentials($safeEmailFieldValue, $passwordFieldValue);
         $loginForm->getElement('email')->setValue($safeEmailFieldValue);
         // Update the "safe" value onto the form
         $adapter->setTimezoneOffset($request->getPost('timezone_offset'));
         $auth = Infra_AuthHelper::getAuthInstance();
         $result = $auth->authenticate($adapter);
         if ($result->isValid()) {
             if ($request->getPost('remember_me')) {
                 Zend_Session::rememberMe(60 * 60 * 24 * 7);
             }
             // 1 week
             $nextUri = $this->_getParam('next_uri');
             if ($nextUri) {
                 $this->_helper->redirector->gotoUrl($nextUri);
             } else {
                 $this->_helper->redirector('list', 'partner');
             }
         } else {
             $loginForm->setDescription('login error');
         }
     }
     $loginForm->setDefault('next_uri', $this->_getParam('next_uri'));
     // set in Infra_AuthPlugin
     $this->view->loginForm = $loginForm;
     $this->view->resetForm = $resetForm;
     $this->render('login');
 }
Ejemplo n.º 3
0
 public function loginAction()
 {
     $loginForm = new Form_Login();
     $resetForm = new Form_ResetPassword();
     $request = $this->getRequest();
     if ($request->isPost()) {
         $adapter = new Kaltura_AuthAdapter($request->getPost('email'), $request->getPost('password'));
         $auth = Zend_Auth::getInstance();
         $result = $auth->authenticate($adapter);
         if ($result->isValid()) {
             if ($request->getPost('remember_me')) {
                 Zend_Session::rememberMe(60 * 60 * 24 * 7);
             }
             // 1 week
             $nextUri = $this->_getParam('next_uri');
             if ($nextUri) {
                 $this->_helper->redirector->gotoUrl($nextUri);
             } else {
                 $this->_helper->redirector('list', 'partner');
             }
         } else {
             $loginForm->setDescription('login error');
         }
     }
     $loginForm->setDefault('next_uri', $this->_getParam('next_uri'));
     // set in Kaltura_AuthPlugin
     $this->view->loginForm = $loginForm;
     $this->view->resetForm = $resetForm;
     $this->render('login');
 }