> For the complete documentation index, see [llms.txt](https://docs.unitlab.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unitlab.ai/documentation/zh/security/authentication-and-account-recovery.md).

# 身份验证与账户恢复

了解如何登录 Unitlab、开启双重身份验证（2FA）并配合 Google Authenticator、1Password 等任意 TOTP 验证器应用使用、妥善保存和重新生成恢复码、重置忘记的密码、删除账户，以及在丢失验证器设备后如何恢复账户访问，保障账户登录安全。

## 登录 <a href="#sign-in" id="sign-in"></a>

使用电子邮件和密码登录，或使用 **Sign in with Google**。如果忘记密码，请在登录页面选择 **Forgot password?**，然后按照邮件中的链接操作。

## 开启双重身份验证 <a href="#turn-on-two-factor-authentication" id="turn-on-two-factor-authentication"></a>

双重身份验证（2FA）会在你每次登录时要求输入验证器应用中的 6 位验证码。它可离线使用，兼容任何支持 TOTP 的应用，例如 Google Authenticator、1Password 或 Authy。

1. 打开 **Settings > Account security**。
2. 在 **Two-factor authentication** 下选择 **Enable 2FA**。
3. 用验证器应用扫描二维码，或将设置密钥复制到应用中。
4. 输入应用中的 6 位验证码进行确认。
5. 将恢复码保存在安全的地方，例如你的密码管理器。

![Account security 页面，包含 Change password、Two-factor authentication、Recovery keys 和 Danger Zone](https://content.gitbook.com/content/vbN1G7M3hTB0Q58dqxlj/blobs/ku3lXNJveGBLFtPqn0Re/account-security.webp)

## 恢复码 <a href="#recovery-codes" id="recovery-codes"></a>

开启 2FA 时你会获得 10 个恢复码。每个恢复码只能使用一次，可代替 6 位验证码。在登录界面选择 **Use a recovery code instead** 即可使用。

如果恢复码已用掉大半，或你认为有人看到过它们，请在 **Recovery keys** 下选择 **Regenerate keys**。旧的恢复码将随即失效。

## 需要第二重验证的操作 <a href="#actions-that-ask-for-your-second-factor" id="actions-that-ask-for-your-second-factor"></a>

开启 2FA 后，Unitlab 会在以下操作前要求输入 6 位验证码或恢复码：

* 更改密码，
* 关闭 2FA，
* 删除你的账户，
* 删除工作区。

## 删除你的账户 <a href="#delete-your-account" id="delete-your-account"></a>

打开 **Settings > Account security**，使用 **Danger Zone** 下的 **Delete Account**。输入确认短语，然后用密码确认；如果已开启 2FA，还需输入 6 位验证码或恢复码。

只有当你拥有的工作区没有其他成员使用过、且没有付费套餐时，它才会随你的账户一起删除。如果你的某个工作区不满足这一条件，账户将不会被删除，一切保持不变。

## 无法使用验证器 <a href="#lost-access-to-your-authenticator" id="lost-access-to-your-authenticator"></a>

使用恢复码登录，然后关闭 2FA，再用新设备重新开启。如果你已没有剩余的恢复码，请使用账户绑定的电子邮件地址联系 Unitlab 支持团队。

## 相关内容 <a href="#related" id="related"></a>

[安全概览](https://docs.unitlab.ai/documentation/zh/security/security-overview.md) · [敏感数据与成员离职](https://docs.unitlab.ai/documentation/zh/security/sensitive-data-and-offboarding.md)
