Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
feat: validate password length
Browse files Browse the repository at this point in the history
  • Loading branch information
hibig committed Aug 25, 2023
1 parent 9db7c12 commit 0b0c029
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 31 deletions.
4 changes: 4 additions & 0 deletions src/assets/style/global.less
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@ body {
font-weight: 500;
}

.bold-400 {
font-weight: 400;
}

.m-t-0 {
margin-top: 0;
}
Expand Down
4 changes: 4 additions & 0 deletions src/assets/style/margin.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
margin-right: 10px;
}

.m-r-20 {
margin-right: 20px;
}

.p-16 {
padding: 16px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,20 @@
:title="$t('applications.applications.detail.configuration')"
:title-style="{ 'margin-bottom': '10px', 'margin-top': 0 }"
>
<moduleWrapper :show-delete="false" :status="true" inner-wrap>
<moduleWrapper :show-delete="false" inner-wrap title="template">
<template #title>
<div class="bold-400">
<span class="m-r-20"
>{{ $t('applications.applications.modules.title') }}:
{{ currentInfo.template?.name }}</span
>
<span
>{{ $t('applications.applications.history.version') }}:{{
currentInfo.template?.version
}}</span
>
</div>
</template>
<serviceInfo ref="serviceInfoRef"> </serviceInfo>
</moduleWrapper>
</ModuleCard>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
}"
@click="handleCollapse"
/>
<span>{{ title }}</span>
</span>
<slot name="title"
><span>{{ title }}</span></slot
>
<icon-delete
v-if="showDelete"
class="btn"
Expand Down Expand Up @@ -93,7 +95,8 @@
background-color: var(--color-fill-2);
&.no-del-btn {
justify-content: flex-end;
flex-direction: row-reverse;
justify-content: space-between;
}
:deep(.arco-icon) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
style="width: 600px"
label-align="left"
>
<a-row :cols="24">
<!-- <a-row :cols="24">
<a-col :span="12">
<a-form-item :label="$t('applications.applications.table.module')">
<span class="readonly-view-label">{{
Expand All @@ -23,7 +23,7 @@
}}</span>
</a-form-item>
</a-col>
</a-row>
</a-row> -->
<a-row>
<a-col>
<a-form-item :label="$t(`applications.projects.form.label`)">
Expand Down
9 changes: 8 additions & 1 deletion src/views/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export const TabPage = {
ENVIRONMENTTAB: 'environmentTab',
COSTTAB: 'costTab',
OPERATORHUBTAB: 'operatorHubTab',
SETTINGSTAB: 'settingsTab'
SETTINGSTAB: 'settingsTab',
USERTAB: 'userTab'
};

export const ProjectTabs = {
Expand Down Expand Up @@ -87,6 +88,12 @@ export const OperatorHubTabs = {
CATALOGS: 'catalogs'
};

export const UserTabs = {
USERS: 'info',
PASSWORD: 'password',
TOKENS: 'tokens'
};

export const QAlinkMap = {
Project: [
{
Expand Down
6 changes: 4 additions & 2 deletions src/views/login/components/modify-password.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
{
required: true,
message: $t('user.password.rules.newpassword')
}
},
{ minLength: 6, message: $t('propfile.password.leastlength') }
]"
>
<seal-input-password
Expand All @@ -42,7 +43,8 @@
{
required: true,
validator: validateConfirmPassword
}
},
{ minLength: 6, message: $t('propfile.password.leastlength') }
]"
>
<seal-input-password
Expand Down
8 changes: 4 additions & 4 deletions src/views/profile/components/perssmion-table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
>
<template #cell="{ record }">
<ReusePermissionState
v-bind="{ record, action: 'POST' }"
v-bind="{ record, action: Actions.POST }"
></ReusePermissionState>
</template>
</a-table-column>
Expand All @@ -115,7 +115,7 @@
>
<template #cell="{ record }">
<ReusePermissionState
v-bind="{ record, action: 'GET' }"
v-bind="{ record, action: Actions.GET }"
></ReusePermissionState>
</template>
</a-table-column>
Expand All @@ -129,7 +129,7 @@
>
<template #cell="{ record }">
<ReusePermissionState
v-bind="{ record, action: 'PUT' }"
v-bind="{ record, action: Actions.PUT }"
></ReusePermissionState>
</template>
</a-table-column>
Expand All @@ -142,7 +142,7 @@
>
<template #cell="{ record }">
<ReusePermissionState
v-bind="{ record, action: 'DELETE' }"
v-bind="{ record, action: Actions.DELETE }"
></ReusePermissionState>
</template>
</a-table-column>
Expand Down
4 changes: 3 additions & 1 deletion src/views/profile/locale/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ export default {
'propfile.permission.table.permission': 'UI Permissions',
'propfile.permission.table.group': 'Group',
'propfile.permission.type.project': 'Project Permissions',
'propfile.permission.type.system': 'System Permissions'
'propfile.permission.type.system': 'System Permissions',
'propfile.password.leastlength':
'password length cannot be less than 6 characters'
};
3 changes: 2 additions & 1 deletion src/views/profile/locale/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ export default {
'propfile.permission.table.permission': '界面权限',
'propfile.permission.table.group': '分组',
'propfile.permission.type.project': '项目权限',
'propfile.permission.type.system': '系统权限'
'propfile.permission.type.system': '系统权限',
'propfile.password.leastlength': '密码长度不能小于6位'
};
24 changes: 19 additions & 5 deletions src/views/profile/pages/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,24 @@
v-model:active-key="activeKey"
:default-active-key="activeKey"
class="page-line-tabs"
@change="setPageTabActive"
>
<a-tab-pane key="userInfo" :title="$t('propfile.account.user.info')">
<a-tab-pane
:key="UserTabs.USERS"
:title="$t('propfile.account.user.info')"
>
<UserInfo></UserInfo>
</a-tab-pane>
<a-tab-pane key="password" :title="$t('user.password.modify')">
<a-tab-pane
:key="UserTabs.PASSWORD"
:title="$t('user.password.modify')"
>
<ModifyPassword></ModifyPassword>
</a-tab-pane>
<a-tab-pane key="tokens" :title="$t('account.settings.apikeys')">
<a-tab-pane
:key="UserTabs.TOKENS"
:title="$t('account.settings.apikeys')"
>
<Tokens></Tokens>
</a-tab-pane>
</a-tabs>
Expand All @@ -43,15 +53,19 @@
import _ from 'lodash';
import { ref, computed } from 'vue';
import { useUserStore } from '@/store';
import { UserTabs } from '@/views/config';
import useTabActive, { TabPage } from '@/hooks/use-tab-active';
import { RoleType, RolesTypeMap } from '@/views/system/config/users';
import HeaderInfo from '@/components/header-info/index.vue';
import GroupTitle from '@/components/group-title/index.vue';
import UserInfo from './user-info.vue';
import ModifyPassword from './modify-password.vue';
import Tokens from './tokens.vue';
const userStore = useUserStore();
const activeKey = ref('userInfo');
const { activeKey, setPageTabActive } = useTabActive(
TabPage.USERTAB,
UserTabs.USERS
);
const userRole = computed(() => {
const { roles } = userStore;
Expand Down
6 changes: 4 additions & 2 deletions src/views/profile/pages/modify-password.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
field="newPassword"
:trigger="['change', 'blur']"
:rules="[
{ required: true, message: $t('user.password.rules.newpassword') }
{ required: true, message: $t('user.password.rules.newpassword') },
{ minLength: 6, message: $t('propfile.password.leastlength') }
]"
>
<seal-input-password
Expand All @@ -42,7 +43,8 @@
{
required: true,
validator: validateConfirmPassword
}
},
{ minLength: 6, message: $t('propfile.password.leastlength') }
]"
>
<seal-input-password
Expand Down
20 changes: 10 additions & 10 deletions src/views/profile/pages/user-info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@
resourceCount: _.keys(policies).length,
isParent: true,
key: _.get(project, `projectName`),
role: _.keys(_.get(project, 'roles'))
// post: calcPermissionCount(projectChildren, Actions.POST),
// get: calcPermissionCount(projectChildren, Actions.GET),
// delete: calcPermissionCount(projectChildren, Actions.DELETE),
// put: calcPermissionCount(projectChildren, Actions.PUT)
role: _.keys(_.get(project, 'roles')),
post: calcPermissionCount(projectChildren, Actions.POST),
get: calcPermissionCount(projectChildren, Actions.GET),
delete: calcPermissionCount(projectChildren, Actions.DELETE),
put: calcPermissionCount(projectChildren, Actions.PUT)
});
});
return resultList;
Expand Down Expand Up @@ -196,11 +196,11 @@
resultList = _.map(resultList, (item) => {
return {
...item,
resource: item.children.length
// post: calcPermissionCount(item.children, Actions.POST),
// get: calcPermissionCount(item.children, Actions.GET),
// delete: calcPermissionCount(item.children, Actions.DELETE),
// put: calcPermissionCount(item.children, Actions.PUT)
resource: item.children.length,
post: calcPermissionCount(item.children, Actions.POST),
get: calcPermissionCount(item.children, Actions.GET),
delete: calcPermissionCount(item.children, Actions.DELETE),
put: calcPermissionCount(item.children, Actions.PUT)
};
});
return resultList;
Expand Down

0 comments on commit 0b0c029

Please sign in to comment.