title = '个人设置'; FontAwesomeAsset::register($this); JqueryAsset::register($this); SimpleWebAuthnBrowser::register($this); $this->registerCssFile('@web/css/user-info.css'); $details = IPLocation::getDetails($model->last_login_ip); // IP LOCATION // QR-CODE if (!is_null($totp_secret)) { $writer = new PngWriter(); $qrCode = QrCode::create($totp_url) ->setEncoding(new Encoding('UTF-8')) ->setErrorCorrectionLevel(ErrorCorrectionLevel::Low) ->setSize(300) ->setMargin(10) ->setRoundBlockSizeMode(RoundBlockSizeMode::Margin) ->setForegroundColor(new Color(0, 0, 0)) ->setBackgroundColor(new Color(255, 255, 255)); $result = $writer->write($qrCode); } // totp $user = new User(); // Dark Mode $darkMode = Yii::$app->user->identity->dark_mode; ?>

title) ?>

getGravatar(email: $model->email, s: 100, img: true, atts: ['alt' => 'User Avatar', 'class' => 'avatar']) ?>

field($model, 'bio')->textarea(['rows' => 6])->label('简介') ?>
'btn btn-success']) ?>

Url::to(['user/change-password']), 'method' => 'post' ]); ?> field($model, 'oldPassword')->passwordInput()->label('原密码') ?> field($model, 'newPassword')->passwordInput()->label('新密码') ?> field($model, 'newPasswordRepeat')->passwordInput()->label('重复新密码') ?>
'btn btn-success']) ?>

二步验证


使用除您密码之外的第二种方法来增强您账号的安全性。

  • TOTP (Authenticator app)
    >
  • 备用码
    'btn btn-outline-primary btn-sm', 'id' => 'generate-backup-codes']) ?>
  • Passwordless验证 (Webauthn) (BETA)
    "webauthn_add", 'type' => 'button', 'class' => 'btn btn-primary btn-sm']) ?> "webauthn_verify", 'type' => 'button', 'class' => 'btn btn-primary btn-sm']) ?> "webauthn_detail", 'type' => 'button', 'class' => 'btn btn-primary btn-sm']) ?>

主题


>
>

删除账户


这个操作不支持撤回,请谨慎操作。

'

更改用户头像

', 'id' => 'avatarModal', ]); echo Html::tag('div', '

要修改头像,请前往Gravatar,使用相同的电子邮箱地址创建/登录账户后对头像进行管理


Q: 修改头像后不起作用?
A: 尝试ctrl+F5强制刷新或清除cache后刷新页面
更多帮助', ['class' => 'modal-body']); Modal::end(); // 修改用户昵称的Modal Modal::begin([ 'title' => '

修改用户昵称

', 'id' => 'changeAccountName', 'size' => 'modal-sm', ]); $form = ActiveForm::begin([ 'action' => ['user/change-name'], 'method' => 'post' ]); echo $form->field($user, 'name')->textInput()->label('新的用户昵称:'); echo Html::submitButton('确认修改', ['class' => 'btn btn-primary']); ActiveForm::end(); Modal::end(); // 删除账户Modal Modal::begin([ 'title' => '

确定?

', 'id' => 'deleteAccountModal', 'size' => 'modal-sm', ]); echo Html::tag('div', '确定要删除这个账户?', ['class' => 'modal-body']); echo Html::beginForm(['user/delete'], 'post', ['id' => 'delete-form']); echo '
'; echo Html::checkbox('deleteConfirm', false, ['label' => '确认', 'id' => 'deleteConfirm']); echo '
'; echo '
'; echo Html::submitButton('继续删除', ['class' => 'btn btn-danger', 'disabled' => true, 'id' => 'deleteButton']); echo '
'; echo Html::endForm(); Modal::end(); // 二步验证Modal Modal::begin([ 'title' => '

需要进一步操作以启用二步验证

', 'id' => 'totpSetupModal', 'size' => 'model-xl', ]); ?>
QR Code

使用兼容TOTP的应用程序扫描左侧二维码以添加二步验证

推荐以下二步验证器::

['user/setup-two-factor'], 'method' => 'post' ]); echo Html::activeHiddenInput($user, 'otp_secret', ['value' => $totp_secret]); echo $form->field($user, 'totp_input')->textInput()->label('最后一步! 输入TOTP应用程序上显示的密码以启用二步验证'); echo Html::submitButton('启用二步验证', ['class' => 'btn btn-primary']); ActiveForm::end(); } ?>
'

管理已添加的Webauthn设备

', 'id' => 'credentialModal', 'size' => 'modal-xl modal-fullscreen-xl-down', ]); echo Html::tag('div', '你可以在下方查看和删除已经添加的Webauthn设备', ['class' => 'modal-body']); $dataProvider = new ActiveDataProvider([ 'query' => PublicKeyCredentialSourceRepository::find()->where(['user_id' => Yii::$app->user->id]), ]); // 使用 GridView 小部件显示数据 Pjax::begin(); echo Html::tag('div', '', ['id' => 'pjax-container']); Pjax::end(); Modal::end(); $this->registerJsFile('@web/js/user-info.js', ['depends' => [JqueryAsset::class, SimpleWebAuthnBrowser::class], 'position' => View::POS_END]); ?>