Files left out of merge
This commit is contained in:
@ -461,8 +461,7 @@ class SettingsController extends Controller
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
switch($choice)
|
||||
{
|
||||
switch ($choice) {
|
||||
case 'google-authenticator':
|
||||
$uri = $this->make(TwoFactorQrCodeUriGeneratorService::class, [$user])->run();
|
||||
return $this->renderAjax('two-factor', ['id' => $id, 'uri' => $uri]);
|
||||
@ -473,9 +472,8 @@ class SettingsController extends Controller
|
||||
// get mobile phone, if exists
|
||||
$mobilePhone=$user->getAuthTfMobilePhone();
|
||||
$smsCode = $this->make(TwoFactorSmsCodeGeneratorService::class, [$user])->run();
|
||||
return $this->renderAjax('two-factor-sms', ['id' => $id, 'code' => $smsCode, 'mobilePhone' => $mobilePhone] );
|
||||
return $this->renderAjax('two-factor-sms', ['id' => $id, 'code' => $smsCode, 'mobilePhone' => $mobilePhone]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function actionTwoFactorEnable($id)
|
||||
@ -499,14 +497,14 @@ class SettingsController extends Controller
|
||||
$module = Yii::$app->getModule('user');
|
||||
$validators = $module->twoFactorAuthenticationValidators;
|
||||
$choice = Yii::$app->request->get('choice');
|
||||
$codeDurationTime = ArrayHelper::getValue($validators,$choice.'.codeDurationTime', 300);
|
||||
$class = ArrayHelper::getValue($validators,$choice.'.class');
|
||||
$codeDurationTime = ArrayHelper::getValue($validators, $choice.'.codeDurationTime', 300);
|
||||
$class = ArrayHelper::getValue($validators, $choice.'.class');
|
||||
|
||||
$object = $this
|
||||
->make($class, [$user, $code, $this->module->twoFactorAuthenticationCycles]);
|
||||
$success = $object->validate();
|
||||
$success = $success && $user->updateAttributes(['auth_tf_enabled' => '1','auth_tf_type' => $choice]);
|
||||
$message = $success? $object->getSuccessMessage():$object->getUnsuccessMessage($codeDurationTime);
|
||||
$message = $success ? $object->getSuccessMessage() : $object->getUnsuccessMessage($codeDurationTime);
|
||||
|
||||
return [
|
||||
'success' => $success,
|
||||
@ -616,9 +614,9 @@ class SettingsController extends Controller
|
||||
$mobilePhone = Yii::$app->request->get('mobilephone');
|
||||
$currentMobilePhone = $user->getAuthTfMobilePhone();
|
||||
$success=false;
|
||||
if($currentMobilePhone==$mobilePhone){
|
||||
if ($currentMobilePhone==$mobilePhone) {
|
||||
$success=true;
|
||||
}else{
|
||||
} else {
|
||||
$success = $user->updateAttributes(['auth_tf_mobile_phone' => $mobilePhone]);
|
||||
$success = $success && $this->make(TwoFactorSmsCodeGeneratorService::class, [$user])->run();
|
||||
}
|
||||
|
||||
@ -67,8 +67,8 @@ class User extends ActiveRecord implements IdentityInterface
|
||||
use ContainerAwareTrait;
|
||||
|
||||
// following constants are used on secured email changing process
|
||||
const OLD_EMAIL_CONFIRMED = 0b01;
|
||||
const NEW_EMAIL_CONFIRMED = 0b10;
|
||||
public const OLD_EMAIL_CONFIRMED = 0b01;
|
||||
public const NEW_EMAIL_CONFIRMED = 0b10;
|
||||
|
||||
/**
|
||||
* @var string Plain password. Used for model validation
|
||||
|
||||
Reference in New Issue
Block a user