refactor(login): layout style
This commit is contained in:
@@ -261,6 +261,10 @@ export default {
|
|||||||
'common.login.auth': 'Authenticating...',
|
'common.login.auth': 'Authenticating...',
|
||||||
'common.login.auth.failed': 'Authentication failed',
|
'common.login.auth.failed': 'Authentication failed',
|
||||||
'common.login.password': 'Log in with Password',
|
'common.login.password': 'Log in with Password',
|
||||||
|
'common.login.username.holder': 'Please enter username',
|
||||||
|
'common.login.password.holder': 'Please enter password',
|
||||||
|
'common.login.newpassword.holder': 'Please enter new password',
|
||||||
|
'common.login.confirm.holder': 'Please enter password again',
|
||||||
'common.external.login': 'Log in with {type}',
|
'common.external.login': 'Log in with {type}',
|
||||||
'common.sso.noConfig':
|
'common.sso.noConfig':
|
||||||
'Single sign-on is not enabled on this system. Please contact your administrator.',
|
'Single sign-on is not enabled on this system. Please contact your administrator.',
|
||||||
|
|||||||
@@ -261,6 +261,10 @@ export default {
|
|||||||
'common.login.auth': 'Authenticating...',
|
'common.login.auth': 'Authenticating...',
|
||||||
'common.login.auth.failed': 'Authentication failed',
|
'common.login.auth.failed': 'Authentication failed',
|
||||||
'common.login.password': 'Log in with Password',
|
'common.login.password': 'Log in with Password',
|
||||||
|
'common.login.username.holder': 'Please enter username',
|
||||||
|
'common.login.password.holder': 'Please enter password',
|
||||||
|
'common.login.newpassword.holder': 'Please enter new password',
|
||||||
|
'common.login.confirm.holder': 'Please enter password again',
|
||||||
'common.external.login': 'Log in with {type}',
|
'common.external.login': 'Log in with {type}',
|
||||||
'common.sso.noConfig':
|
'common.sso.noConfig':
|
||||||
'Single sign-on is not enabled on this system. Please contact your administrator.',
|
'Single sign-on is not enabled on this system. Please contact your administrator.',
|
||||||
|
|||||||
@@ -260,6 +260,10 @@ export default {
|
|||||||
'common.login.auth': 'Аутентификация...',
|
'common.login.auth': 'Аутентификация...',
|
||||||
'common.login.auth.failed': 'Ошибка аутентификации',
|
'common.login.auth.failed': 'Ошибка аутентификации',
|
||||||
'common.login.password': 'Войти с паролем',
|
'common.login.password': 'Войти с паролем',
|
||||||
|
'common.login.username.holder': 'Введите имя пользователя',
|
||||||
|
'common.login.password.holder': 'Введите пароль',
|
||||||
|
'common.login.newpassword.holder': 'Введите новый пароль',
|
||||||
|
'common.login.confirm.holder': 'Введите пароль ещё раз',
|
||||||
'common.external.login': 'Войти через {type}',
|
'common.external.login': 'Войти через {type}',
|
||||||
'common.sso.noConfig':
|
'common.sso.noConfig':
|
||||||
'Единый вход не настроен в этой системе. Пожалуйста, обратитесь к администратору.',
|
'Единый вход не настроен в этой системе. Пожалуйста, обратитесь к администратору.',
|
||||||
|
|||||||
@@ -264,6 +264,10 @@ export default {
|
|||||||
'common.login.auth': 'Kimlik doğrulanıyor...',
|
'common.login.auth': 'Kimlik doğrulanıyor...',
|
||||||
'common.login.auth.failed': 'Kimlik doğrulama başarısız',
|
'common.login.auth.failed': 'Kimlik doğrulama başarısız',
|
||||||
'common.login.password': 'Şifre ile giriş yap',
|
'common.login.password': 'Şifre ile giriş yap',
|
||||||
|
'common.login.username.holder': 'Lütfen kullanıcı adını girin',
|
||||||
|
'common.login.password.holder': 'Lütfen şifreyi girin',
|
||||||
|
'common.login.newpassword.holder': 'Lütfen yeni şifreyi girin',
|
||||||
|
'common.login.confirm.holder': 'Lütfen şifreyi tekrar girin',
|
||||||
'common.external.login': '{type} ile giriş yap',
|
'common.external.login': '{type} ile giriş yap',
|
||||||
'common.sso.noConfig':
|
'common.sso.noConfig':
|
||||||
'Bu sistemde çoklu oturum açma etkinleştirilmemiş. Lütfen yöneticinize başvurun.',
|
'Bu sistemde çoklu oturum açma etkinleştirilmemiş. Lütfen yöneticinize başvurun.',
|
||||||
|
|||||||
@@ -254,6 +254,10 @@ export default {
|
|||||||
'common.login.auth': '认证中...',
|
'common.login.auth': '认证中...',
|
||||||
'common.login.auth.failed': '认证失败',
|
'common.login.auth.failed': '认证失败',
|
||||||
'common.login.password': '使用密码登录',
|
'common.login.password': '使用密码登录',
|
||||||
|
'common.login.username.holder': '请输入用户名',
|
||||||
|
'common.login.password.holder': '请输入密码',
|
||||||
|
'common.login.newpassword.holder': '请输入新密码',
|
||||||
|
'common.login.confirm.holder': '请再次输入密码',
|
||||||
'common.external.login': '使用 {type} 登录',
|
'common.external.login': '使用 {type} 登录',
|
||||||
'common.sso.noConfig': '该系统未启用单点登录,请联系管理员。',
|
'common.sso.noConfig': '该系统未启用单点登录,请联系管理员。',
|
||||||
'common.button.edit.item': '编辑 {name}',
|
'common.button.edit.item': '编辑 {name}',
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import {
|
|||||||
LockOutlined,
|
LockOutlined,
|
||||||
UserOutlined
|
UserOutlined
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { Input as CInput, HighlightCode, IconFont } from '@gpustack/core-ui';
|
import { HighlightCode, IconFont } from '@gpustack/core-ui';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Button, Divider, Form, FormInstance } from 'antd';
|
import { Button, Divider, Flex, Form, FormInstance, Input } from 'antd';
|
||||||
import { createStyles } from 'antd-style';
|
import { createStyles } from 'antd-style';
|
||||||
|
|
||||||
const useStyles = createStyles(({ token, css }) => {
|
const useStyles = createStyles(({ token, css }) => {
|
||||||
@@ -28,6 +28,23 @@ const useStyles = createStyles(({ token, css }) => {
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
`,
|
||||||
|
password: css`
|
||||||
|
.ant-input-suffix {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
.reset-link {
|
||||||
|
padding: 0;
|
||||||
|
font-size: 12px;
|
||||||
|
color: ${token.colorTextSecondary};
|
||||||
|
}
|
||||||
|
.ant-divider {
|
||||||
|
margin-left: 2px;
|
||||||
|
}
|
||||||
|
.reset-link:hover {
|
||||||
|
color: var(--ant-color-link-hover);
|
||||||
|
}
|
||||||
|
}
|
||||||
`
|
`
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -78,11 +95,17 @@ const LocalUserForm: React.FC<LocalUserFormProps> = (props) => {
|
|||||||
// Same shape Buttons uses: 360px design width, capped at the
|
// Same shape Buttons uses: 360px design width, capped at the
|
||||||
// parent's inner width so the form doesn't overflow on the
|
// parent's inner width so the form doesn't overflow on the
|
||||||
// enterprise cover layout (272px inner).
|
// enterprise cover layout (272px inner).
|
||||||
|
layout="vertical"
|
||||||
|
requiredMark={false}
|
||||||
style={{ width: '360px', maxWidth: '100%', margin: '0 auto' }}
|
style={{ width: '360px', maxWidth: '100%', margin: '0 auto' }}
|
||||||
onFinish={handleLogin}
|
onFinish={handleLogin}
|
||||||
>
|
>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="username"
|
name="username"
|
||||||
|
label={intl.formatMessage({ id: 'common.form.username' })}
|
||||||
|
style={{
|
||||||
|
marginBottom: 20
|
||||||
|
}}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
@@ -95,14 +118,21 @@ const LocalUserForm: React.FC<LocalUserFormProps> = (props) => {
|
|||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<CInput.Input
|
<Input
|
||||||
autoComplete="username"
|
autoComplete="username"
|
||||||
label={intl.formatMessage({ id: 'common.form.username' })}
|
placeholder={intl.formatMessage({
|
||||||
|
id: 'common.login.username.holder'
|
||||||
|
})}
|
||||||
prefix={<UserOutlined />}
|
prefix={<UserOutlined />}
|
||||||
|
style={{ height: 44 }}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
|
style={{
|
||||||
|
marginBottom: 20
|
||||||
|
}}
|
||||||
name="password"
|
name="password"
|
||||||
|
label={intl.formatMessage({ id: 'common.form.password' })}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
@@ -115,36 +145,37 @@ const LocalUserForm: React.FC<LocalUserFormProps> = (props) => {
|
|||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<CInput.Password
|
<Input.Password
|
||||||
|
className={styles.password}
|
||||||
autoComplete="current-password"
|
autoComplete="current-password"
|
||||||
prefix={<LockOutlined />}
|
prefix={<LockOutlined />}
|
||||||
label={intl.formatMessage({ id: 'common.form.password' })}
|
style={{ height: 44 }}
|
||||||
|
placeholder={intl.formatMessage({
|
||||||
|
id: 'common.login.password.holder'
|
||||||
|
})}
|
||||||
|
suffix={
|
||||||
|
<Flex align="center" gap={0}>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
className="reset-link"
|
||||||
|
href={externalLinks.resetPassword}
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
{intl.formatMessage({ id: 'common.button.forgotpassword' })}
|
||||||
|
</Button>
|
||||||
|
<Divider orientation="vertical" />
|
||||||
|
</Flex>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<div
|
|
||||||
className="flex-center"
|
|
||||||
style={{
|
|
||||||
justifyContent: 'flex-end',
|
|
||||||
marginBottom: 20
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Button
|
|
||||||
type="link"
|
|
||||||
size="small"
|
|
||||||
href={externalLinks.resetPassword}
|
|
||||||
target="_blank"
|
|
||||||
style={{ padding: 0 }}
|
|
||||||
>
|
|
||||||
{intl.formatMessage({ id: 'common.button.forgotpassword' })}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
<Button
|
<Button
|
||||||
htmlType="submit"
|
htmlType="submit"
|
||||||
type="primary"
|
type="primary"
|
||||||
block
|
block
|
||||||
loading={props.loading}
|
loading={props.loading}
|
||||||
icon={<IconFont type="icon-login" />}
|
icon={<IconFont type="icon-login" />}
|
||||||
style={{ height: '48px', fontSize: '14px' }}
|
style={{ height: '44px', fontSize: '14px', marginTop: 16 }}
|
||||||
>
|
>
|
||||||
{intl.formatMessage({ id: 'common.button.login' })}
|
{intl.formatMessage({ id: 'common.button.login' })}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -7,9 +7,8 @@ import {
|
|||||||
writeState
|
writeState
|
||||||
} from '@/utils/localstore/index';
|
} from '@/utils/localstore/index';
|
||||||
import { LockOutlined } from '@ant-design/icons';
|
import { LockOutlined } from '@ant-design/icons';
|
||||||
import { Input as CInput } from '@gpustack/core-ui';
|
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Button, Form, message } from 'antd';
|
import { Button, Form, Input, message } from 'antd';
|
||||||
import CryptoJS from 'crypto-js';
|
import CryptoJS from 'crypto-js';
|
||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
import { updatePassword } from '../apis';
|
import { updatePassword } from '../apis';
|
||||||
@@ -56,13 +55,14 @@ const PasswordForm: React.FC = () => {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Form
|
<Form
|
||||||
|
layout="vertical"
|
||||||
|
requiredMark={false}
|
||||||
form={form}
|
form={form}
|
||||||
style={{ width: '360px', margin: '0 auto' }}
|
style={{ margin: '0 auto' }}
|
||||||
onFinish={handleSubmit}
|
onFinish={handleSubmit}
|
||||||
>
|
>
|
||||||
<h2 className="justify-center m-b-20 flex-column flex-center">
|
<h2 className="justify-center m-b-20 flex-column flex-center">
|
||||||
<span>
|
<span>
|
||||||
{' '}
|
|
||||||
{intl.formatMessage({ id: 'users.password.modify.title' })}
|
{intl.formatMessage({ id: 'users.password.modify.title' })}
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
@@ -78,6 +78,8 @@ const PasswordForm: React.FC = () => {
|
|||||||
</h2>
|
</h2>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="new_password"
|
name="new_password"
|
||||||
|
style={{ marginBottom: 20 }}
|
||||||
|
label={intl.formatMessage({ id: 'users.form.newpassword' })}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
@@ -88,14 +90,19 @@ const PasswordForm: React.FC = () => {
|
|||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<CInput.Password
|
<Input.Password
|
||||||
|
style={{ height: 44 }}
|
||||||
autoComplete="new-password"
|
autoComplete="new-password"
|
||||||
|
placeholder={intl.formatMessage({
|
||||||
|
id: 'common.login.newpassword.holder'
|
||||||
|
})}
|
||||||
prefix={<LockOutlined />}
|
prefix={<LockOutlined />}
|
||||||
label={intl.formatMessage({ id: 'users.form.newpassword' })}
|
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
|
style={{ marginBottom: 20 }}
|
||||||
name="confirm_password"
|
name="confirm_password"
|
||||||
|
label={intl.formatMessage({ id: 'users.password.confirm' })}
|
||||||
dependencies={['new_password']}
|
dependencies={['new_password']}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
@@ -118,10 +125,13 @@ const PasswordForm: React.FC = () => {
|
|||||||
})
|
})
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<CInput.Password
|
<Input.Password
|
||||||
|
style={{ height: 44 }}
|
||||||
autoComplete="new-password"
|
autoComplete="new-password"
|
||||||
|
placeholder={intl.formatMessage({
|
||||||
|
id: 'common.login.confirm.holder'
|
||||||
|
})}
|
||||||
prefix={<LockOutlined />}
|
prefix={<LockOutlined />}
|
||||||
label={intl.formatMessage({ id: 'users.password.confirm' })}
|
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
@@ -129,7 +139,7 @@ const PasswordForm: React.FC = () => {
|
|||||||
htmlType="submit"
|
htmlType="submit"
|
||||||
type="primary"
|
type="primary"
|
||||||
block
|
block
|
||||||
style={{ height: '48px', fontSize: '14px', marginTop: 10 }}
|
style={{ height: '44px', fontSize: '14px', marginTop: 16 }}
|
||||||
>
|
>
|
||||||
{intl.formatMessage({ id: 'common.button.submit' })}
|
{intl.formatMessage({ id: 'common.button.submit' })}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -72,12 +72,18 @@ const Box = styled.div`
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
|
.ant-form-item-label {
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
.ant-form-item-label > label {
|
||||||
|
height: auto !important;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const FormWrapper = styled.div`
|
const FormWrapper = styled.div`
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
margin-top: 50vh;
|
margin-top: 50vh;
|
||||||
width: 440px;
|
width: 400px;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
|
|||||||
Reference in New Issue
Block a user