} else { $accessiblegroups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()); $accessibleusers = OC_Group::displayNamesInGroups($accessiblegroups, '', 30); $subadmins = false; } // load preset quotas //~ $quotaPreset=OC_Appconfig::getValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB'); //~ $quotaPreset=explode(',', $quotaPreset); //~ foreach($quotaPreset as &$preset) { //~ $preset=trim($preset); //~ } //~ $quotaPreset=array_diff($quotaPreset, array('default', 'none')); //~ $defaultQuota=OC_Appconfig::getValue('files', 'default_quota', 'none'); //~ $defaultQuotaIsUserDefined=array_search($defaultQuota, $quotaPreset)===false //~ && array_search($defaultQuota, array('none', 'default'))===false; $mOtp = new MultiOtpDb(OCP\Config::getAppValue('user_otp', 'EncryptionKey', 'DefaultCliEncryptionKey')); // load users and quota foreach ($accessibleusers as $uid => $displayName) { //~ $quota=OC_Preferences::getValue($uid, 'files', 'quota', 'default'); //~ $isQuotaUserDefined=array_search($quota, $quotaPreset)===false //~ && array_search($quota, array('none', 'default'))===false; $name = $displayName; if ($displayName !== $uid) { $name = $name . ' (' . $uid . ')'; } $UserTokenSeed = ""; $UserLocked = ""; $UserAlgorithm = ""; $UserPin = ""; $UserPrefixPin = ""; //get otp information :
* @license http://opensource.org/licenses/AGPL-3.0 GNU AFFERO GENERAL PUBLIC LICENSE * */ include_once "user_otp/lib/utils.php"; $l = OC_L10N::get('settings'); OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('user_otp'); OCP\JSON::callCheck(); if ($_POST && $_POST["uid"] && OC_User::isAdminUser(OCP\User::getUser())) { OC_JSON::checkSubAdminUser(); $uid = $_POST["uid"]; } else { $uid = OCP\User::getUser(); } // Get data $mOtp = new MultiOtpDb(OCP\Config::getAppValue('user_otp', 'EncryptionKey', 'DefaultCliEncryptionKey')); $mOtp->EnableVerboseLog(); //$mOtp->SetDisplayLogOption(1); if ($_POST && $_POST["otp_action"] === "delete_otp" && $mOtp->CheckUserExists($uid)) { if ($mOtp->DeleteUser($uid)) { OCP\JSON::success(array("data" => array("message" => $l->t("OTP Changed")))); } else { OCP\JSON::error(array("data" => array("message" => $l->t("check apps folder rights")))); } } else { if ($_POST && $_POST["otp_action"] === "send_email_otp" && $mOtp->CheckUserExists($uid)) { $mOtp->SetUser($uid); if (OCP\Config::getAppValue('user_otp', 'TokenBase32Encode', true)) { $UserTokenSeed = base32_encode(hex2bin($mOtp->GetUserTokenSeed())); //$tmpl->assign('TokenBase32Encode',true); } else {
* License as published by the Free Software Foundation; either * version 3 of the License, or any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC * License along with this library. If not, see <http://www.gnu.org/licenses/>. * Displays <a href="http://opensource.org/licenses/AGPL-3.0">GNU AFFERO GENERAL PUBLIC LICENSE</a> * @license http://opensource.org/licenses/AGPL-3.0 GNU AFFERO GENERAL PUBLIC LICENSE * */ OCP\Util::addscript('user_otp', 'personalSettings'); $mOtp = new MultiOtpDb(OCP\Config::getAppValue('user_otp', 'EncryptionKey', 'DefaultCliEncryptionKey')); $mOtp->EnableVerboseLog(); //~ $mOtp->SetUsersFolder( //~ OCP\Config::getAppValue( //~ 'user_otp','UsersFolder', //~ getcwd()."/apps/user_otp/3rdparty/multiotp/users/" //~ ) //~ ); $tmpl = new OCP\Template('user_otp', 'personalSettings'); $tmpl->assign('disableDeleteOtpForUsers', OCP\Config::getAppValue('user_otp', 'disableDeleteOtpForUsers', '0')); if ($mOtp->CheckUserExists(OCP\User::getUser())) { $tmpl->assign('UserExists', true); $mOtp->SetUser(OCP\User::getUser()); $img = \OCP\Util::linkToRoute('user_otp_qrcode'); $tmpl->assign('UserTokenUrlLink', $mOtp->GetUserTokenUrlLink()); $tmpl->assign('UserTokenQrCode', $img);