-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add login page ip detect (#2819)
* feat: add login page ip detect * code perf
- Loading branch information
1 parent
efcb53c
commit 691476c
Showing
11 changed files
with
255 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
packages/web/components/common/Icon/icons/common/language/America.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions
8
packages/web/components/common/Icon/icons/common/language/China.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
{ | ||
"Chinese_ip_tip": "It is detected that you are a mainland Chinese IP, click to jump to visit the mainland China version.", | ||
"Login": "Login", | ||
"forget_password": "Find password", | ||
"login_failed": "Login failed", | ||
"login_success": "Login successful", | ||
"no_remind": "Don't remind again", | ||
"password_condition": "Password maximum 60 characters", | ||
"policy_tip": "By useing, you agree to our", | ||
"privacy": "Privacy policy", | ||
"redirect": "Jump", | ||
"register": "Register", | ||
"root_password_placeholder": "The root user password is the value of the environment variable DEFAULT_ROOT_PSW", | ||
"terms": "Terms", | ||
"use_root_login": "Log in as root user" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { langMap } from '@/web/common/utils/i18n'; | ||
import { Avatar, Box, Flex } from '@chakra-ui/react'; | ||
import MySelect from '@fastgpt/web/components/common/MySelect'; | ||
import { useI18nLng } from '@fastgpt/web/hooks/useI18n'; | ||
import { useTranslation } from 'next-i18next'; | ||
import { useMemo } from 'react'; | ||
import MyIcon from '@fastgpt/web/components/common/Icon'; | ||
|
||
const I18nLngSelector = () => { | ||
const { i18n } = useTranslation(); | ||
const { onChangeLng } = useI18nLng(); | ||
|
||
const list = useMemo(() => { | ||
return Object.entries(langMap).map(([key, lang]) => ({ | ||
label: ( | ||
<Flex alignItems={'center'}> | ||
<MyIcon borderRadius={'0'} mr={2} name={lang.avatar as any} w={'14px'} h={'9px'} /> | ||
<Box>{lang.label}</Box> | ||
</Flex> | ||
), | ||
value: key | ||
})); | ||
}, []); | ||
|
||
return ( | ||
<MySelect | ||
_hover={{ | ||
bg: 'myGray.200' | ||
}} | ||
value={i18n.language} | ||
list={list} | ||
onchange={(val: any) => { | ||
const lang = val; | ||
onChangeLng(lang); | ||
}} | ||
/> | ||
); | ||
}; | ||
|
||
export default I18nLngSelector; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.