From 71caa8e1bd941d22f9ad48cd188f48a549cca324 Mon Sep 17 00:00:00 2001 From: AlexBob <5199840@qq.com> Date: Tue, 25 Jun 2024 09:52:02 +0800 Subject: [PATCH] =?UTF-8?q?docs(logout):=20=E4=B8=BA=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E4=B8=AD=E7=9A=84=E7=99=BB=E5=87=BA=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E6=B7=BB=E5=8A=A0=E8=AF=A6=E7=BB=86=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/projects/web/src/core/security/login/login.service.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui/projects/web/src/core/security/login/login.service.ts b/ui/projects/web/src/core/security/login/login.service.ts index 9a9d06ed..1c9c946c 100644 --- a/ui/projects/web/src/core/security/login/login.service.ts +++ b/ui/projects/web/src/core/security/login/login.service.ts @@ -62,9 +62,18 @@ export class LoginService { return this.credentials; } + /** + * 登出功能实现。 + * 该方法负责协调登录状态的解除和相关登录信息的清除工作。 + * 它调用认证模块的登出方法来解除用户认证状态,然后从存储中移除登录凭证, + * 最后将本地持有的凭证信息置为null,表示登出成功。 + */ logout() { + // 调用认证模块的登出方法,解除用户认证状态 this.auth.logout(); + // 从存储中移除登录凭证,确保凭证信息不被非法访问 this.storage.remove(this.storageKey); + // 将本地持有的凭证信息置为null,表示当前用户已登出 this.credentials = null; } }