private function getUserId() { $this->requireLogin(); if (Helper::getConfigValue('SPREED_WEBRTC_IS_SHARED_INSTANCE')) { // Return cloud id instead return $this->getCloudId(); } return $this->user->getUID(); }
private static function testOwncloudPhpConfigFile() { if (strlen(Helper::getConfigValue('SPREED_WEBRTC_SHAREDSECRET')) !== 64) { return 'SPREED_WEBRTC_SHAREDSECRET in config/config.php must be a 64 character hexadecimal string.'; } if (!ctype_xdigit(Helper::getConfigValue('SPREED_WEBRTC_SHAREDSECRET'))) { return 'Invalid SPREED_WEBRTC_SHAREDSECRET in config/config.php. Secret may only contain hexadecimal characters.'; } if (Helper::getConfigValue('OWNCLOUD_TEMPORARY_PASSWORD_LOGIN_ENABLED') === true) { if (strlen(Helper::getConfigValue('OWNCLOUD_TEMPORARY_PASSWORD_SIGNING_KEY')) !== 64) { return 'OWNCLOUD_TEMPORARY_PASSWORD_SIGNING_KEY in config/config.php must be a 64 character hexadecimal string.'; } if (!ctype_xdigit(Helper::getConfigValue('OWNCLOUD_TEMPORARY_PASSWORD_SIGNING_KEY'))) { return 'Invalid OWNCLOUD_TEMPORARY_PASSWORD_SIGNING_KEY in config/config.php. Key may only contain hexadecimal characters.'; } } }
public static function generateTemporaryPassword($userid, $expiration = 0, $version = self::TP_VERSION, $forValidation = false) { self::requireEnabledTemporaryPassword(); // Only prevent certain characters and decorate userid if we don't want to validate a given TP if (!$forValidation) { $disallowed = array(':', '/'); foreach ($disallowed as $char) { if (strpos($userid, $char) !== false) { throw new \Exception('userid may not contain one of these symbols: ' . join(' or ', $disallowed), ErrorCodes::TEMPORARY_PASSWORD_INVALID_USERID); } } $userid = self::decorateUserId($userid, 'ext'); } $key = Helper::getConfigValue('OWNCLOUD_TEMPORARY_PASSWORD_SIGNING_KEY'); $max_age = 60 * 60 * 2; if ($expiration > 0) { // Use a fixed expiration date $signed_combo_array = self::getSignedUsercomboArray($version, $userid, $key, false, $expiration); } else { // Dynamically expire after x seconds $signed_combo_array = self::getSignedUsercomboArray($version, $userid, $key, $max_age); } return $signed_combo_array['useridcombo'] . ':' . $signed_combo_array['secret']; }
<?php use OCA\SpreedME\Helper\Helper; $iframe_url = Helper::getSpreedWebRtcUrl(); script('spreedme', '../extra/static/PostMessageAPI'); script('spreedme', 'webrtc'); style('spreedme', 'webrtc'); $sharedConfig = array('is_guest' => $_['is_guest'] === true, 'features' => array('temporary_password' => Helper::getConfigValue('OWNCLOUD_TEMPORARY_PASSWORD_LOGIN_ENABLED') === true)); ?> <script id="sharedconfig" type="application/json"><?php // Not an issue to output this directly, json_encode by default has disabled JSON_UNESCAPED_SLASHES echo json_encode($sharedConfig); ?> </script> <div id="debug"><b>Debug</b><br /></div> <div id="container"> <iframe src="<?php echo $iframe_url; ?> " allowfullscreen></iframe> </div>