@drax/identity-vue 0.0.27 → 0.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.0.27",
6
+ "version": "0.0.29",
7
7
  "type": "module",
8
8
  "main": "./src/index.ts",
9
9
  "module": "./src/index.ts",
@@ -24,10 +24,10 @@
24
24
  "format": "prettier --write src/"
25
25
  },
26
26
  "dependencies": {
27
- "@drax/common-front": "^0.0.27",
28
- "@drax/common-share": "^0.0.27",
29
- "@drax/common-vue": "^0.0.27",
30
- "@drax/identity-share": "^0.0.27",
27
+ "@drax/common-front": "^0.0.29",
28
+ "@drax/common-share": "^0.0.29",
29
+ "@drax/common-vue": "^0.0.29",
30
+ "@drax/identity-share": "^0.0.29",
31
31
  "vue-i18n": "^9.13.1"
32
32
  },
33
33
  "peerDependencies": {
@@ -64,5 +64,5 @@
64
64
  "vue-tsc": "^2.0.11",
65
65
  "vuetify": "^3.6.4"
66
66
  },
67
- "gitHead": "bdfe3169ed4088f221468eb536a115802a091377"
67
+ "gitHead": "a067a1fc430dbc7d31835de79cfe385ba9935914"
68
68
  }
@@ -64,7 +64,7 @@ async function submitChangePassowrd() {
64
64
  <template v-else>
65
65
 
66
66
  <v-form @submit.prevent="submitChangePassowrd">
67
- <v-card variant="outlined">
67
+ <v-card variant="elevated">
68
68
  <v-card-title class="pa-4 text-center">{{ $t('user.changeOwnPassword') }}</v-card-title>
69
69
  <v-card-text v-if="errorMsg">
70
70
  <v-alert type="error">
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import {computed, defineProps, ref} from 'vue'
2
+ import {computed, ref, defineEmits} from 'vue'
3
3
  import {useAuth} from '../../composables/useAuth.js'
4
4
  import IdentityProfileView from "../IdentityProfileView/IdentityProfileView.vue";
5
5
 
@@ -12,10 +12,13 @@ const loading = ref(false)
12
12
 
13
13
  const isFormValid = computed(() => username.value.trim() !== '' && password.value.trim() !== '')
14
14
 
15
+ const emit = defineEmits(['loginSuccess'])
16
+
15
17
  async function submitLogin() {
16
18
  try {
17
19
  loading.value = true
18
20
  await login(username.value, password.value)
21
+ emit('loginSuccess')
19
22
  } catch (e) {
20
23
  const error = e as Error
21
24
  authError.value = error.message
@@ -24,25 +27,6 @@ async function submitLogin() {
24
27
  }
25
28
  }
26
29
 
27
- // Define props for customizing labels, title, and button text
28
- const props = defineProps({
29
- title: {
30
- type: String,
31
- default: 'Login'
32
- },
33
- usernameLabel: {
34
- type: String,
35
- default: 'Username'
36
- },
37
- passwordLabel: {
38
- type: String,
39
- default: 'Password'
40
- },
41
- buttonText: {
42
- type: String,
43
- default: 'Login'
44
- }
45
- })
46
30
 
47
31
  let passwordVisibility = ref(false)
48
32
 
@@ -53,72 +37,68 @@ function togglePasswordVisibility() {
53
37
  </script>
54
38
 
55
39
  <template>
56
- <v-container>
57
40
 
58
- <template v-if="isAuthenticated()">
59
- <v-card>
60
- <identity-profile-view></identity-profile-view>
61
- </v-card>
62
- </template>
41
+ <template v-if="isAuthenticated()">
42
+ <v-card>
43
+ <v-card-text>
44
+ <identity-profile-view></identity-profile-view>
45
+ </v-card-text>
46
+ </v-card>
47
+ </template>
48
+
49
+ <template v-else>
63
50
 
64
- <template v-else>
65
- <v-row justify="center">
66
- <v-col cols="12" sm="8" md="6" lg="5" xl="4">
67
- <v-form @submit.prevent="submitLogin">
68
- <v-card variant="elevated" class="pa-6">
69
- <v-card-title class="pa-4 text-center">{{ props.title }}</v-card-title>
70
- <v-card-text v-if="authError">
71
- <v-alert type="error">
72
- {{ $t ? $t(authError) : authError }}
73
- </v-alert>
74
- </v-card-text>
75
- <v-card-text>
76
- <div class="text-subtitle-1 text-medium-emphasis">{{ props.usernameLabel }}</div>
77
- <v-text-field
78
- variant="outlined"
79
- id="username-input"
80
- v-model="username"
81
- prepend-inner-icon="mdi-lock-outline"
82
- required
83
- autocomplete="new-username"
84
- ></v-text-field>
85
- <div class="text-subtitle-1 text-medium-emphasis">{{ props.passwordLabel }}</div>
86
- <v-text-field
87
- variant="outlined"
88
- id="password-input"
89
- v-model="password"
90
- :type="passwordVisibility ? 'text': 'password'"
91
- required
92
- prepend-inner-icon="mdi-lock-outline"
93
- :append-inner-icon="passwordVisibility ? 'mdi-eye-off': 'mdi-eye'"
94
- @click:append-inner="togglePasswordVisibility"
95
- autocomplete="new-password"
96
- ></v-text-field>
97
- </v-card-text>
98
- <v-card-actions>
99
- <v-spacer></v-spacer>
100
- <v-btn
101
- class="mb-8"
102
- color="blue"
103
- size="large"
104
- variant="tonal"
105
- id="submit-button"
106
- type="submit"
107
- block
108
- :disabled="!isFormValid"
109
- :loading="loading"
110
- >
111
- {{ props.buttonText }}
112
- </v-btn>
113
- </v-card-actions>
114
- </v-card>
115
- </v-form>
116
- </v-col>
117
- </v-row>
118
- </template>
119
- </v-container>
51
+ <v-form @submit.prevent="submitLogin">
52
+ <v-card variant="elevated" class="pa-6">
53
+ <v-card-title class="pa-4 text-center">{{ $t ? $t('auth.signIn') : 'Sign In' }}</v-card-title>
54
+ <v-card-text v-if="authError">
55
+ <v-alert type="error">
56
+ {{ $t ? $t(authError) : authError }}
57
+ </v-alert>
58
+ </v-card-text>
59
+ <v-card-text>
60
+ <div class="text-subtitle-1 text-medium-emphasis">{{ $t ? $t('auth.username') : 'Username' }}</div>
61
+ <v-text-field
62
+ variant="outlined"
63
+ id="username-input"
64
+ v-model="username"
65
+ prepend-inner-icon="mdi-lock-outline"
66
+ required
67
+ autocomplete="new-username"
68
+ ></v-text-field>
69
+ <div class="text-subtitle-1 text-medium-emphasis">{{ $t ? $t('auth.password') : 'Password' }}</div>
70
+ <v-text-field
71
+ variant="outlined"
72
+ id="password-input"
73
+ v-model="password"
74
+ :type="passwordVisibility ? 'text': 'password'"
75
+ required
76
+ prepend-inner-icon="mdi-lock-outline"
77
+ :append-inner-icon="passwordVisibility ? 'mdi-eye-off': 'mdi-eye'"
78
+ @click:append-inner="togglePasswordVisibility"
79
+ autocomplete="new-password"
80
+ ></v-text-field>
81
+ </v-card-text>
82
+ <v-card-actions>
83
+ <v-spacer></v-spacer>
84
+ <v-btn
85
+ class="mb-8"
86
+ color="blue"
87
+ size="large"
88
+ variant="tonal"
89
+ id="submit-button"
90
+ type="submit"
91
+ block
92
+ :disabled="!isFormValid"
93
+ :loading="loading"
94
+ >
95
+ {{ $t ? $t('auth.login') : 'Login' }}
96
+ </v-btn>
97
+ </v-card-actions>
98
+ </v-card>
99
+ </v-form>
100
+ </template>
120
101
  </template>
121
102
 
122
- <style scoped lang="sass">
123
- // Your styles here
103
+ <style scoped>
124
104
  </style>
@@ -1,7 +1,8 @@
1
1
  <script setup lang="ts">
2
+ import {defineEmits} from 'vue'
2
3
  import {useAuthStore} from "../../stores/auth/AuthStore.js";
3
4
 
4
- const emit = defineEmits(['click'])
5
+
5
6
 
6
7
  defineProps({
7
8
  avatarSize: {
@@ -15,24 +16,28 @@ defineProps({
15
16
  })
16
17
 
17
18
  const authStore = useAuthStore()
18
- const onClick = () => {
19
- emit('click')
20
- }
19
+
20
+ const emits = defineEmits(['click'])
21
+
21
22
  </script>
22
23
 
23
24
  <template>
24
25
  <v-avatar
25
26
  :size="avatarSize"
26
- @click="onClick"
27
+ @click="emits('click')"
27
28
  color="surface"
28
29
  class="border-md border-opacity-100 border-surface-light"
29
30
  :class="customClass"
30
31
  >
31
- <v-img v-if="authStore.authUser && authStore.authUser.avatar" :src="authStore.authUser.avatar"/>
32
+ <v-img v-if="authStore.authUser && authStore.authUser.avatar" :src="authStore.authUser.avatar" class="d-flex justify-center align-center">
33
+ <slot />
34
+ </v-img>
32
35
  <v-icon v-else size="50">mdi-account-circle</v-icon>
36
+
33
37
  </v-avatar>
34
38
  </template>
35
39
 
36
40
  <style scoped>
37
41
 
42
+
38
43
  </style>
@@ -0,0 +1,69 @@
1
+ <script setup lang="ts">
2
+ import {ref} from 'vue'
3
+ import {useAuth} from "../../composables/useAuth";
4
+ import IdentityProfileAvatar from "../IdentityProfileAvatar/IdentityProfileAvatar.vue";
5
+
6
+ const {changeAvatar} = useAuth();
7
+
8
+ let fileInput = ref()
9
+ let showEdit = ref(false)
10
+
11
+
12
+ function onAvatarClick() {
13
+ fileInput.value.click();
14
+ }
15
+
16
+ async function onFileChanged(e: Event) {
17
+ console.log("OnFileChanged",e)
18
+ if (e.target && (e.target as HTMLInputElement).files) {
19
+ const files = (e.target as HTMLInputElement).files;
20
+ if (files && files[0]) {
21
+ await changeAvatar(files[0]);
22
+ }
23
+ }
24
+ }
25
+
26
+ defineProps({
27
+ avatarSize: {
28
+ type: Number,
29
+ default: 54
30
+ }
31
+ })
32
+
33
+ </script>
34
+
35
+ <template>
36
+ <div @mouseenter="showEdit = true" @mouseleave="showEdit= false" >
37
+ <identity-profile-avatar
38
+ :avatar-size="avatarSize"
39
+ @click="onAvatarClick"
40
+ >
41
+ <v-icon v-if="showEdit" size="35" color="white" class="mdi mdi-pencil bg-black rounded"></v-icon>
42
+ </identity-profile-avatar>
43
+ <input
44
+ accept="image/png, image/jpeg, image/jpg"
45
+ ref="fileInput"
46
+ class="d-none"
47
+ type="file"
48
+ @change="onFileChanged"
49
+ >
50
+ </div>
51
+ </template>
52
+
53
+ <style scoped>
54
+ .v-avatar {
55
+ cursor: pointer;
56
+ transition: all .4s ease-in-out;
57
+ -webkit-touch-callout: none;
58
+ -webkit-user-select: none;
59
+ -moz-user-select: none;
60
+ -ms-user-select: none;
61
+ user-select: none;
62
+ }
63
+
64
+ .v-avatar:hover {
65
+ filter: brightness(80%);
66
+ }
67
+
68
+
69
+ </style>
@@ -2,12 +2,13 @@
2
2
  import {useAuth} from "../../composables/useAuth";
3
3
  import {defineModel, ref} from "vue";
4
4
  import IdentityProfileView from "../IdentityProfileView/IdentityProfileView.vue";
5
- import IdentityChangeOwnPassword from "../../components/IdentityChangeOwnPassword/IdentityChangeOwnPassword.vue";
5
+ import {useRouter} from "vue-router";
6
+
7
+ const router = useRouter()
8
+
6
9
 
7
10
  const auth = useAuth()
8
11
  const valueModel = defineModel<boolean>()
9
- const profile = ref(false)
10
- const changePassword = ref(false)
11
12
 
12
13
 
13
14
  </script>
@@ -26,7 +27,7 @@ const changePassword = ref(false)
26
27
 
27
28
  <v-list>
28
29
  <v-list-item
29
- @click="profile = !profile"
30
+ @click="router.push({name:'Profile'})"
30
31
  prepend-icon="mdi-account-cog"
31
32
  :title="$t('user.profile')"
32
33
  >
@@ -51,27 +52,6 @@ const changePassword = ref(false)
51
52
  </v-list>
52
53
  </template>
53
54
 
54
- <v-dialog v-model="profile" fullscreen :on-after-leave="() => changePassword=false">
55
- <v-toolbar>
56
- <v-toolbar-title>
57
- {{$t('user.profile')}}
58
- </v-toolbar-title>
59
- <v-spacer></v-spacer>
60
- <v-btn icon @click="profile = !profile">
61
- <v-icon>mdi-close</v-icon>
62
- </v-btn>
63
- </v-toolbar>
64
- <v-card >
65
- <v-card-text class="flex-shrink-1 flex-grow-0">
66
- <identity-profile-view></identity-profile-view>
67
- </v-card-text>
68
- <v-card-text class="text-center flex-grow-1">
69
- <IdentityChangeOwnPassword v-if="changePassword"></IdentityChangeOwnPassword>
70
- <v-btn v-else color="blue" variant="tonal" @click="changePassword = true">{{$t('user.changeOwnPassword')}}</v-btn>
71
-
72
- </v-card-text>
73
- </v-card>
74
- </v-dialog>
75
55
 
76
56
  </v-navigation-drawer>
77
57
 
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import {useAuthStore} from "../../stores/auth/AuthStore.js";
3
- import IdentityProfileAvatar from "../IdentityProfileAvatar/IdentityProfileAvatar.vue";
3
+ import IdentityProfileAvatarEdit from "../IdentityProfileAvatarEdit/IdentityProfileAvatarEdit.vue";
4
4
  const emit = defineEmits(['click'])
5
5
  const authStore = useAuthStore()
6
6
 
@@ -10,7 +10,7 @@ const authStore = useAuthStore()
10
10
  <v-sheet class="position-relative d-flex justify-center align-center" height="150">
11
11
  <v-sheet class="position-absolute bg-surface-light w-100 top-0" height="65"></v-sheet>
12
12
  <v-sheet class="text-center">
13
- <identity-profile-avatar :avatar-size="70"></identity-profile-avatar>
13
+ <identity-profile-avatar-edit :avatar-size="90"></identity-profile-avatar-edit>
14
14
  <h6 class="text-h6">{{ authStore.authUser?.username }}</h6>
15
15
  </v-sheet>
16
16
  </v-sheet>
@@ -1,53 +1,65 @@
1
1
  import {useAuthStore} from "../stores/auth/AuthStore";
2
2
  import {AuthHelper, AuthSystem} from "@drax/identity-front";
3
3
  import {inject} from "vue";
4
+ import {useRouter} from 'vue-router'
4
5
 
5
6
  export function useAuth() {
6
7
 
7
8
  const authStore = useAuthStore()
9
+ const router = useRouter()
8
10
 
9
11
  const authSystem = inject('AuthSystem') as AuthSystem
10
12
 
11
- const login = async (username:string, password:string) => {
12
- const {accessToken} = await authSystem.login(username, password)
13
- authStore.setAccessToken(accessToken)
14
- const authUser = await authSystem.me()
15
- authStore.setAuthUser(authUser)
13
+ const login = async (username: string, password: string) => {
14
+ const {accessToken} = await authSystem.login(username, password)
15
+ authStore.setAccessToken(accessToken)
16
+ const authUser = await authSystem.me()
17
+ authStore.setAuthUser(authUser)
18
+ }
19
+
20
+ const changeOwnPassword = async (currentPassword: string, newPassword: string) => {
21
+ return await authSystem.changeOwnPassword(currentPassword, newPassword)
16
22
  }
17
23
 
18
- const changeOwnPassword = async (currentPassword:string, newPassword:string) => {
19
- return await authSystem.changeOwnPassword(currentPassword, newPassword)
24
+ const changeAvatar = async (file: File) => {
25
+ if(file){
26
+ await authSystem.changeAvatar(file)
27
+ await fetchAuthUser()
28
+ return
29
+ }
30
+
20
31
  }
21
32
 
22
33
  async function fetchAuthUser() {
23
- const authUser = await authSystem.me()
34
+ const authUser = await authSystem.me()
24
35
  authStore.setAuthUser(authUser)
25
36
  return authUser
26
37
  }
27
38
 
28
- function logout(){
39
+ function logout() {
29
40
  authSystem.logout()
30
41
  authStore.clearAuth()
42
+ router.push({name: 'Login'})
31
43
  }
32
44
 
33
- function hasPermission(permission:string) {
45
+ function hasPermission(permission: string) {
34
46
  return authStore?.authUser?.role?.permissions ? authStore.authUser.role.permissions.includes(permission) : false
35
47
  }
36
48
 
37
- function tokenIsValid(){
49
+ function tokenIsValid() {
38
50
  return authStore.accessToken ? AuthHelper.isJWTValid(authStore.accessToken) : false
39
51
  }
40
52
 
41
- function isAuthenticated(){
42
- if(tokenIsValid()){
53
+ function isAuthenticated() {
54
+ if (tokenIsValid()) {
43
55
  return true
44
- }else{
56
+ } else {
45
57
  logout()
46
58
  return false
47
59
  }
48
60
 
49
61
  }
50
62
 
51
- return {hasPermission, logout, tokenIsValid, isAuthenticated, fetchAuthUser, login, changeOwnPassword}
63
+ return {hasPermission, logout, tokenIsValid, isAuthenticated, fetchAuthUser, login, changeOwnPassword, changeAvatar}
52
64
 
53
65
  }
@@ -108,8 +108,8 @@ function toDelete(item: IRole) {
108
108
  <template>
109
109
  <v-container fluid>
110
110
 
111
- <v-sheet border rounded>
112
- <v-toolbar>
111
+ <v-card border rounded>
112
+ <v-toolbar class="bg-toolbar">
113
113
  <v-toolbar-title>{{$t('role.managing')}}</v-toolbar-title>
114
114
  <v-spacer></v-spacer>
115
115
  <v-btn icon @click="filterEnable = !filterEnable">
@@ -127,7 +127,7 @@ function toDelete(item: IRole) {
127
127
  :filterEnable="filterEnable"
128
128
  />
129
129
  </v-theme-provider>
130
- </v-sheet>
130
+ </v-card>
131
131
 
132
132
  <v-dialog v-model="dialog" max-width="800">
133
133
  <v-sheet border>
@@ -71,8 +71,8 @@ defineExpose({
71
71
  @update:options="loadItems"
72
72
  >
73
73
  <template v-slot:top>
74
- <v-toolbar border density="compact" v-if="filterEnable" class="grey-lighten-1">
75
- <v-toolbar-title>{{ $t('action.filter') }}</v-toolbar-title>
74
+ <v-toolbar density="compact" v-if="filterEnable">
75
+ <v-toolbar-title>{{ $t('action.filters') }}</v-toolbar-title>
76
76
  <v-spacer></v-spacer>
77
77
  <v-text-field v-model="search" hide-details
78
78
  density="compact" class="mr-2"
@@ -105,14 +105,14 @@ function toDelete(item: ITenant) {
105
105
  <template>
106
106
  <v-container fluid>
107
107
 
108
- <v-sheet border rounded>
109
- <v-toolbar>
108
+ <v-card border rounded >
109
+ <v-toolbar class="bg-toolbar">
110
110
  <v-toolbar-title>{{ $t('tenant.managing') }}</v-toolbar-title>
111
111
  <v-spacer></v-spacer>
112
112
  <v-btn icon @click="filterEnable = !filterEnable">
113
113
  <v-icon>{{ filterEnable ? 'mdi-filter' : 'mdi-filter-off' }}</v-icon>
114
114
  </v-btn>
115
- <v-btn color="primary" @click="toCreate">
115
+ <v-btn class="font-weight-bold" color="primary" @click="toCreate">
116
116
  {{ $t('action.create') }}
117
117
  </v-btn>
118
118
  </v-toolbar>
@@ -124,7 +124,7 @@ function toDelete(item: ITenant) {
124
124
  :filterEnable="filterEnable"
125
125
  />
126
126
  </v-theme-provider>
127
- </v-sheet>
127
+ </v-card>
128
128
 
129
129
  <v-dialog v-model="dialog" max-width="800">
130
130
  <v-sheet border>
@@ -54,6 +54,7 @@ defineExpose({
54
54
 
55
55
  <template>
56
56
  <v-data-table-server
57
+ class="border"
57
58
  v-if="hasPermission('user:manage')"
58
59
  v-model:items-per-page="itemsPerPage"
59
60
  v-model:page="page"
@@ -66,8 +67,8 @@ defineExpose({
66
67
  @update:options="loadItems"
67
68
  >
68
69
  <template v-slot:top>
69
- <v-toolbar border density="compact" v-if="filterEnable" class="grey-lighten-1">
70
- <v-toolbar-title>{{ $t('action.filter') }}</v-toolbar-title>
70
+ <v-toolbar density="compact" v-if="filterEnable">
71
+ <v-toolbar-title>{{ $t('action.filters') }}</v-toolbar-title>
71
72
  <v-spacer></v-spacer>
72
73
  <v-text-field v-model="search" hide-details
73
74
  density="compact" class="mr-2"
@@ -139,8 +139,8 @@ function toChangePassword(item: IUser) {
139
139
  <template>
140
140
  <v-container fluid>
141
141
 
142
- <v-sheet border rounded>
143
- <v-toolbar>
142
+ <v-card border rounded>
143
+ <v-toolbar class="bg-toolbar">
144
144
  <v-toolbar-title>{{ $t('user.managing') }}</v-toolbar-title>
145
145
  <v-spacer></v-spacer>
146
146
  <v-btn icon @click="filterEnable = !filterEnable">
@@ -159,7 +159,7 @@ function toChangePassword(item: IUser) {
159
159
  :filterEnable="filterEnable"
160
160
  />
161
161
  </v-theme-provider>
162
- </v-sheet>
162
+ </v-card>
163
163
 
164
164
  <v-dialog v-model="dialog" max-width="800">
165
165
  <v-sheet border>
@@ -73,8 +73,8 @@ defineExpose({
73
73
  @update:options="loadItems"
74
74
  >
75
75
  <template v-slot:top>
76
- <v-toolbar border density="compact" v-if="filterEnable" class="grey-lighten-1">
77
- <v-toolbar-title>{{ $t('action.filter') }}</v-toolbar-title>
76
+ <v-toolbar density="compact" v-if="filterEnable">
77
+ <v-toolbar-title>{{ $t('action.filters') }}</v-toolbar-title>
78
78
  <v-spacer></v-spacer>
79
79
  <v-text-field v-model="search" hide-details
80
80
  density="compact" class="mr-2"
@@ -1,4 +1,5 @@
1
- import {commonValidationI18n, identityValidationI18n} from "@drax/i18n-share"
1
+ import {CommonI18nMessages} from "@drax/common-front"
2
+ import {IdentityI18nMessages} from "@drax/identity-front"
2
3
  import merge from 'deepmerge'
3
4
 
4
5
  const mainMsg = {
@@ -14,7 +15,7 @@ const mainMsg = {
14
15
  }
15
16
  }
16
17
 
17
- const messages = merge.all([mainMsg,commonValidationI18n, identityValidationI18n])
18
+ const messages = merge.all([mainMsg,IdentityI18nMessages, CommonI18nMessages])
18
19
 
19
20
  console.log("messages",messages)
20
21
 
package/src/index.ts CHANGED
@@ -16,6 +16,10 @@ import RoleCrud from "./cruds/role-crud/RoleCrud.vue";
16
16
  import RoleList from "./cruds/role-crud/RoleList.vue";
17
17
  import RoleCrudPage from "./pages/RoleCrudPage.vue";
18
18
 
19
+ import LoginPage from "./pages/LoginPage.vue";
20
+ import ProfilePage from "./pages/ProfilePage.vue";
21
+ import PasswordPage from "./pages/PasswordPage.vue";
22
+
19
23
 
20
24
  import TenantForm from "./forms/TenantForm.vue";
21
25
  import TenantView from "./views/TenantView.vue";
@@ -31,6 +35,8 @@ import {useTenant} from "./composables/useTenant.js";
31
35
 
32
36
  import {useAuthStore} from "./stores/auth/AuthStore.js";
33
37
 
38
+ import IdentityRoutes from "./routes/IdentityRoutes.js";
39
+
34
40
  export {
35
41
 
36
42
  //Vue Components
@@ -39,6 +45,11 @@ export {
39
45
  IdentityProfileView,
40
46
  IdentityProfileDrawer,
41
47
 
48
+ //Pages
49
+ LoginPage,
50
+ ProfilePage,
51
+ PasswordPage,
52
+
42
53
  //User
43
54
  UserView,
44
55
  UserCreateForm,
@@ -67,5 +78,8 @@ export {
67
78
 
68
79
 
69
80
  //Stores
70
- useAuthStore
81
+ useAuthStore,
82
+
83
+ //Routes
84
+ IdentityRoutes
71
85
  }
@@ -0,0 +1,48 @@
1
+ <script setup lang="ts">
2
+
3
+ import IdentityLogin from "../components/IdentityLogin/IdentityLogin.vue";
4
+ import { useDisplay, useTheme } from 'vuetify'
5
+ import { computed } from 'vue'
6
+ import {useRouter} from "vue-router";
7
+
8
+ const router = useRouter()
9
+
10
+ const { mobile } = useDisplay()
11
+ const theme = useTheme()
12
+ const primaryColor = computed(() => theme.current.value.colors.primary)
13
+ const primaryColorText = computed(() => theme.current.value.colors.background)
14
+
15
+
16
+ const TITLE_MAIN = import.meta.env.VITE_TITLE_MAIN || 'DRAX';
17
+ const TITLE_SEC = import.meta.env.VITE_TITLE_SEC || 'SUITE';
18
+
19
+ function onLoginSuccess(){
20
+ router.push('/')
21
+ }
22
+
23
+ </script>
24
+
25
+ <template>
26
+ <v-container fluid class="fill-height">
27
+
28
+ <v-row justify="center" align="center">
29
+ <v-col cols="12" sm="8" md="6" lg="5">
30
+ <h2 class="pb-10 text-center default-cursor" :class="mobile ? 'text-h4' : 'text-h2'">
31
+ <span class="pa-3 font-weight-medium rounded logo">{{TITLE_MAIN}}</span> {{TITLE_SEC}}
32
+ </h2>
33
+
34
+ <IdentityLogin @loginSuccess="onLoginSuccess"></IdentityLogin>
35
+ </v-col>
36
+ </v-row>
37
+
38
+ </v-container>
39
+ </template>
40
+
41
+ <style scoped>
42
+ .logo {
43
+ background-color: v-bind(primaryColor);
44
+ color: v-bind(primaryColorText) !important;
45
+ }
46
+
47
+ </style>
48
+
@@ -0,0 +1,22 @@
1
+ <script setup lang="ts">
2
+
3
+
4
+ import IdentityChangeOwnPassword from "../components/IdentityChangeOwnPassword/IdentityChangeOwnPassword.vue";
5
+ </script>
6
+
7
+ <template>
8
+ <v-container fluid class="fill-height">
9
+
10
+ <v-row justify="center" align="center">
11
+ <v-col cols="12" sm="8" md="6" lg="5">
12
+ <identity-change-own-password />
13
+ </v-col>
14
+ </v-row>
15
+
16
+ </v-container>
17
+ </template>
18
+
19
+ <style scoped>
20
+
21
+ </style>
22
+
@@ -0,0 +1,30 @@
1
+ <script setup lang="ts">
2
+ import IdentityProfileView from "../components/IdentityProfileView/IdentityProfileView.vue";
3
+ import {useRouter} from "vue-router";
4
+ import IdentityProfileAvatarChanger from "@/components/IdentityProfileAvatarEdit/IdentityProfileAvatarEdit.vue";
5
+ const router = useRouter();
6
+
7
+ </script>
8
+
9
+ <template>
10
+ <v-container fluid class="fill-height">
11
+
12
+ <v-row justify="center" align="center">
13
+ <v-col cols="12" sm="8" md="6" lg="5">
14
+
15
+ <v-card>
16
+ <identity-profile-view> </identity-profile-view>
17
+ <v-card-text class="text-center">
18
+ <v-btn color="blue" variant="tonal" @click="router.push({name: 'Password'})">{{$t('user.changeOwnPassword')}}</v-btn>
19
+ </v-card-text>
20
+ </v-card>
21
+ </v-col>
22
+ </v-row>
23
+
24
+ </v-container>
25
+ </template>
26
+
27
+ <style scoped>
28
+
29
+ </style>
30
+
@@ -0,0 +1,64 @@
1
+ import LoginPage from '../pages/LoginPage.vue'
2
+ import ProfilePage from '../pages/ProfilePage.vue'
3
+ import PasswordPage from '../pages/PasswordPage.vue'
4
+ import UserCrudPage from '../pages/UserCrudPage.vue'
5
+ import RoleCrudPage from '../pages/RoleCrudPage.vue'
6
+ import TenantCrudPage from '../pages/TenantCrudPage.vue'
7
+
8
+ const routes = [
9
+ {
10
+ name: 'Login',
11
+ path: '/login',
12
+ component: LoginPage,
13
+ meta: {
14
+ auth: false,
15
+ }
16
+ },
17
+ {
18
+ name: 'Profile',
19
+ path: '/profile',
20
+ component: ProfilePage,
21
+ meta: {
22
+ auth: true,
23
+ }
24
+ },
25
+ {
26
+ name: 'Password',
27
+ path: '/password',
28
+ component: PasswordPage,
29
+ meta: {
30
+ auth: true,
31
+ }
32
+ },
33
+ {
34
+ name: 'CrudRole',
35
+ path: '/crud/role',
36
+ component: RoleCrudPage,
37
+ meta: {
38
+ auth: true,
39
+ permission: 'role:manage'
40
+ }
41
+ },
42
+ {
43
+ name: 'CrudTenant',
44
+ path: '/crud/tenant',
45
+ component: TenantCrudPage,
46
+ meta: {
47
+ auth: true,
48
+ permission: 'tenant:manage'
49
+ }
50
+ },
51
+ {
52
+ name: 'CrudUser',
53
+ path: '/crud/user',
54
+ component: UserCrudPage,
55
+ meta: {
56
+ auth: true,
57
+ permission: 'user:manage'
58
+ }
59
+ },
60
+
61
+ ]
62
+
63
+
64
+ export default routes
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import type {PropType} from "vue";
3
- import type {IRole} from "@drax/identity-front";
3
+ import type {IRole} from "@drax/identity-share";
4
4
 
5
5
  defineProps({
6
6
  role:{
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import type {PropType} from "vue";
3
- import type {ITenant} from "@drax/identity-front";
3
+ import type {ITenant} from "@drax/identity-share";
4
4
 
5
5
  defineProps({
6
6
  tenant:{
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import type {PropType} from "vue";
3
- import type {IUser} from "@drax/identity-front";
3
+ import type {IUser} from "@drax/identity-share";
4
4
  import IdentityProfileAvatar from "../components/IdentityProfileAvatar/IdentityProfileAvatar.vue";
5
5
 
6
6
  defineProps({