示例#1
0
 */
include_once "user_otp/lib/otp.php";
OC::$CLASSPATH['OC_USER_OTP'] = 'user_otp/lib/otp.php';
OCP\App::registerAdmin('user_otp', 'adminSettings');
OCP\App::registerPersonal('user_otp', 'personalSettings');
//if(OCP\Config::getAppValue('user_otp','forceCreateUsers')){
//    OCP\Util::connectHook('OC_User','pre_createUser','OC_USER_OTP','deleteBackends');
//}
//if(OCP\Config::getAppValue('user_otp','disableBackends')){
//    OC_User::clearBackends();
//}
// Nothing to do if user is already logged
//if (!OCP\User::isLoggedIn()){
if (OCP\Config::getAppValue('user_otp', 'authMethod', _AUTH_DEFAULT_) !== _AUTH_STANDARD_) {
    //OC_Log::write('user_otp', 'app load', OC_Log::DEBUG);
    $usedBackends = OC_User::getUsedBackends();
    OC_User::clearBackends();
    OC_USER_OTP::registerBackends($usedBackends);
    OC_User::useBackend('OTP');
    //$otpBackend = new OC_USER_OTP($usedBackends);
    //OC_User::useBackend($otpBackend);
    //~ foreach($usedBackends as $backend){
    //~ OC_User::useBackend($backend);
    //~ }
    //var_dump($otpBackend);exit;
}
//var_dump(OCP\Config::getAppValue('user_otp','inputOtpAfterPwd','0'));
//exit;
if (!OCP\User::isLoggedIn()) {
    if (OCP\Config::getAppValue('user_otp', 'authMethod', _AUTH_DEFAULT_) === _AUTH_TWOFACTOR_ && OCP\Config::getAppValue('user_otp', 'inputOtpAfterPwd', '0') !== '1') {
        // Load js code in order to add passco fix node field into the normal login form