private function proccessMyInfoForm(Form_MyInfo $form) { $this->view->done = false; $request = $this->getRequest(); $formData = $request->getPost(); if ($form->isValid($formData)) { $client = Infra_ClientHelper::getClient(); $client->setKs(null); $auth = Infra_AuthHelper::getAuthInstance(); $identity = $auth->getIdentity(); try { $client->user->updateLoginData($identity->getUser()->email, $request->getPost('old_password'), $request->getPost('email_address'), $request->getPost('new_password')); $ks = $client->user->loginByLoginId($request->getPost('email_address'), $request->getPost('new_password'), Infra_ClientHelper::getPartnerId()); $client->setKs($ks); $user = $client->user->getByLoginId($request->getPost('email_address'), Infra_ClientHelper::getPartnerId()); if ($user->partnerId != Infra_ClientHelper::getPartnerId()) { throw new Exception('', 'LOGIN_DATA_NOT_FOUND'); } $identity = new Kaltura_AdminUserIdentity($user, $ks); $auth->getStorage()->write($identity); // new identity (email could be updated) $this->view->done = true; } catch (Exception $ex) { if ($ex->getCode() === 'LOGIN_DATA_NOT_FOUND') { $form->setDescription('user not found'); } else { if ($ex->getCode() === 'WRONG_OLD_PASSWORD') { $form->getElement('old_password')->addErrorMessage('invalid password')->markAsError(); $form->setDescription('old password is wong'); } else { if ($ex->getCode() === 'PASSWORD_STRUCTURE_INVALID') { $form->setDescription('new password structure is invalid'); } else { if ($ex->getCode() === 'PASSWORD_ALREADY_USED') { $form->setDescription('password was already used before'); } else { if ($ex->getCode() === 'USER_ALREADY_EXISTS') { $form->setDescription('new email is already used by a different user'); } else { if ($ex->getCode() === 'USER_NOT_FOUND') { $form->setDescription('user not found'); } else { if ($ex->getCode() === 'INVALID_FIELD_VALUE') { $form->setDescription('new email is invalid'); } else { throw $ex; } } } } } } } } } else { $form->populate($formData); } }