public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { defPartnerservices2baseAction::disableCache(); $email = trim($this->getPM("email")); try { $new_password = UserLoginDataPeer::resetUserPassword($email); } catch (kUserException $e) { $code = $e->getCode(); if ($code == kUserException::LOGIN_DATA_NOT_FOUND) { $this->addException(APIErrors::ADMIN_KUSER_NOT_FOUND); return null; } if ($code == kUserException::PASSWORD_STRUCTURE_INVALID) { $this->addException(APIErrors::PASSWORD_STRUCTURE_INVALID); return null; } if ($code == kUserException::PASSWORD_ALREADY_USED) { $this->addException(APIErrors::PASSWORD_ALREADY_USED); return null; } if ($code == kUserException::INVALID_EMAIL) { $this->addException(APIErrors::INVALID_FIELD_VALUE, 'email'); return null; } if ($code == kUserException::LOGIN_ID_ALREADY_USED) { $this->addException(APIErrors::LOGIN_ID_ALREADY_USED); return null; } throw $e; } if (!$new_password) { $this->addException(APIErrors::ADMIN_KUSER_NOT_FOUND); } $this->addMsg("msg", "email sent"); }
/** * Reset admin user password and send it to the users email address * * @param string $email * * @throws KalturaErrors::LOGIN_DATA_NOT_FOUND * @throws KalturaErrors::PASSWORD_STRUCTURE_INVALID * @throws KalturaErrors::PASSWORD_ALREADY_USED * @throws KalturaErrors::INVALID_FIELD_VALUE * @throws KalturaErrors::LOGIN_ID_ALREADY_USED */ protected function resetPasswordImpl($email) { KalturaResponseCacher::disableCache(); $this->validateApiAccessControlByEmail($email); try { $new_password = UserLoginDataPeer::resetUserPassword($email); } catch (kUserException $e) { $code = $e->getCode(); if ($code == kUserException::LOGIN_DATA_NOT_FOUND) { throw new KalturaAPIException(KalturaErrors::LOGIN_DATA_NOT_FOUND, "user not found"); } else { if ($code == kUserException::PASSWORD_STRUCTURE_INVALID) { throw new KalturaAPIException(KalturaErrors::PASSWORD_STRUCTURE_INVALID); } else { if ($code == kUserException::PASSWORD_ALREADY_USED) { throw new KalturaAPIException(KalturaErrors::PASSWORD_ALREADY_USED); } else { if ($code == kUserException::INVALID_EMAIL) { throw new KalturaAPIException(KalturaErrors::INVALID_FIELD_VALUE, 'email'); } else { if ($code == kUserException::LOGIN_ID_ALREADY_USED) { throw new KalturaAPIException(KalturaErrors::LOGIN_ID_ALREADY_USED); } } } } } throw $e; } if (!$new_password) { throw new KalturaAPIException(KalturaErrors::LOGIN_DATA_NOT_FOUND, "user not found"); } }