Repository navigation
fix: The portal login page is not displaying the custom name. #7885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ import { v7 as uuidv7 } from 'uuid' | |
| import ChatAuthApi from '@/api/chat/auth' | ||
| import { CHAT_API_BASE_PATH } from '@/api/constants' | ||
| import { LOGIN_METHOD } from '@/api/enums' | ||
| import type { ApplicationAuthProfileMeta, LoginConfig, LoginMethod } from '@/api/types' | ||
| import type { ApplicationAuthProfileMeta, LoginConfig, LoginMethod, PortalAuthProfileMeta } from '@/api/types' | ||
| import { useStore } from '@/stores/chat' | ||
| import LoginModePanel from '@/views/login/components/LoginModePanel.vue' | ||
| import type { LoginService } from '@/views/login/types' | ||
|
|
@@ -23,7 +23,9 @@ const { auth } = useStore() | |
| const isClientLoggingIn = ref(false) | ||
| console.log(auth) | ||
| const loginTitle = computed(() => { | ||
| if (auth.isPortal) return '门户登录' | ||
| if (auth.isPortal) { | ||
| return (auth.authProfile?.meta as PortalAuthProfileMeta | undefined)?.portal_name || '门户登录' | ||
| } | ||
| return (auth.authProfile?.meta as ApplicationAuthProfileMeta | undefined)?.application_name || '登录' | ||
| }) | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's the review of the provided diff: Issues / Potential Problems
Optimization Suggestions
Minor correctness note |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review of the diff
Type-safety break introduced (potential bug in callers).
Changing
PortalAuthProfilefromAuthProfile(default generic) toAuthProfile<PortalAuthProfileMeta>narrows the type. Any code that previously constructed aPortalAuthProfilewith the old meta shape (or relied on the default generic) will now fail to compile or pass an incompatible object. Verify all usages:AuthProfilewithout generics — what is the default? If it'sAuthProfile<unknown>orAuthProfile<any>, existing assignments may silently continue working but lose safety.portal_name.Consistency with
ApplicationAuthProfile. The pattern matches — good. But confirm:portal_name? Type-only changes won't enforce anything at runtime.portal_name? If not, the declared type lies.Required vs optional field.
portal_name: stringis required. If older putaways/records may omit it (backwards compatibility), considerportal_name?: stringor a migration path. Same question forapplication_name— if it's already required, fine, but be explicit about why.Naming/generic default. Check
AuthProfile's definition: if its generic has a default like= unknown, thenAuthProfilewrites remain valid and the change is safe-ish; if the default is something else (e.g.,Record<string, any>), document the intent. Consider making the generic constraint explicit (AuthProfile<T extends ...>).Optimization (minor).
Diff hygiene. The hunk header says
@@ -20,11 +20,15 @@but the visible context is small; ensure surrounding declarations (e.g., other*AuthProfileMetainterfaces) are consistent in JSDoc style (English comment added/** 单应用… */exists; the newPortalAuthProfileMetalacks a doc comment). Add one for consistency.No tests visible. Add/adjust a type/unit test asserting a valid
PortalAuthProfilerequiresportal_nameand that downstream consumers accept it.Verdict: Structurally correct and consistent with the application counterpart, but semantically breaking — grep all
PortalAuthProfileusages, check runtime schemas and backend contracts, and decide whetherportal_nameshould be optional for backward compatibility before merging.