@hostlink/nuxt-light 0.0.75 → 0.0.76

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/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "0.0.75"
4
+ "version": "0.0.76"
5
5
  }
@@ -5,12 +5,10 @@ import { useLight, q, getCurrentUser, m, f } from '../';
5
5
  import { ref, computed, reactive, provide, watch } from 'vue';
6
6
  import { useRuntimeConfig } from 'nuxt/app';
7
7
 
8
-
9
8
  const config = useRuntimeConfig();
10
9
 
11
10
  const appVersion = config.public.appVersion ?? '0.0.1';
12
11
 
13
-
14
12
  const quasar = useQuasar();
15
13
  quasar.dark.set(false);
16
14
  const light = useLight();
@@ -62,15 +60,11 @@ const toggleRightDrawer = () => {
62
60
  rightDrawerOpen.value = !rightDrawerOpen.value
63
61
  }
64
62
 
65
-
66
- let isAdmin = false;
67
63
  let showViewAs = false;
68
64
  if (user.value && user.value.roles.indexOf('Administrators') != -1) {
69
- isAdmin = true;
70
65
  showViewAs = true;
71
66
  }
72
67
 
73
-
74
68
  const menuOverlayHeader = ref(false)
75
69
  const layoutView = computed(() => {
76
70
  let s = ''
@@ -86,10 +80,8 @@ const style = reactive({
86
80
  dense: my.styles?.dense || false
87
81
  });
88
82
 
89
-
90
83
  const isMouseOnDrawer = ref(false)
91
84
 
92
-
93
85
  const isMini = computed(() => {
94
86
  if (isMouseOnDrawer.value) {
95
87
  return false
@@ -165,7 +157,6 @@ const exitViewAs = async () => {
165
157
  window.location.reload();
166
158
  }
167
159
 
168
-
169
160
  const storageColor = computed(() => {
170
161
  if (system) {
171
162
  if (system.diskFreeSpacePercent < 0.05) {
@@ -196,7 +187,6 @@ const storageUsagePercent = computed(() => {
196
187
  return 0;
197
188
  })
198
189
 
199
-
200
190
  </script>
201
191
 
202
192
  <template>
@@ -247,13 +237,10 @@ const storageUsagePercent = computed(() => {
247
237
  </div>
248
238
 
249
239
  <div class="text-right">
250
- {{ user.roles.join(",") }}
240
+ {{ user.roles[0] }}
251
241
  </div>
252
242
  </div>
253
243
 
254
-
255
-
256
-
257
244
  <q-btn flat round dense icon="sym_o_person" class="q-mr-sm">
258
245
  <q-menu max-width="250px">
259
246
  <q-list>
@@ -71,11 +71,7 @@ if (props.addBtn) {
71
71
  showAddBtn = true
72
72
  }
73
73
 
74
- //const title = props.title || route.path.split("/")[1];
75
-
76
- //title split by Capital letter, but if Captial letter is followed by another Capital letter, it is not split
77
- const title = props.title || route.path.split("/")[1].replace(/([A-Z])(?=[A-Z])/g, '$1 ').replace(/([a-z])(?=[A-Z])/g, '$1 ');
78
-
74
+ const title = props.title || route.path.split("/")[1].replace(/([a-z])(?=[A-Z])/g, '$1 ').replace(/([A-Z]*)(?=[A-Z][a-z])/g, '$1 ')
79
75
  const module = route.path.split("/")[1];
80
76
  const onDelete = async () => {
81
77
 
@@ -0,0 +1,93 @@
1
+ <script setup>
2
+ import { reactive, onMounted } from "vue"
3
+ import { Notify } from "quasar";
4
+ import { q, m } from '../../../'
5
+ let { app, my } = await q({ app: ['googleClientId'], my: ["gmail"] })
6
+
7
+ my = reactive(my);
8
+
9
+ const handleGoogleCredentialResponse = async (response) => {
10
+ try {
11
+ await m("googleRegister", { credential: response.credential })
12
+
13
+ const resp = await q("my", ["gmail"]);
14
+ my.gmail = resp.gmail;
15
+
16
+ Notify.create({
17
+ message: "Google account linked",
18
+ color: "positive",
19
+ position: "top",
20
+ timeout: 2000
21
+ });
22
+ } catch (e) {
23
+ console.log(e)
24
+ }
25
+ }
26
+
27
+ onMounted(() => {
28
+ if (app.googleClientId) {
29
+ if (!window.google) {
30
+ Notify.create({
31
+ message: "Google login is not available", //set script https://accounts.google.com/gsi/client in nuuxt.config.js
32
+ color: "negative",
33
+ icon: "sym_o_error",
34
+ position: "top",
35
+ timeout: 2000
36
+ });
37
+ return;
38
+ }
39
+ }
40
+
41
+ //google
42
+ google.accounts.id.initialize({
43
+ client_id: app.googleClientId,
44
+ callback: handleGoogleCredentialResponse,
45
+ });
46
+
47
+ google.accounts.id.renderButton(
48
+ document.getElementById('g_id_signin'),
49
+ {
50
+ type: 'profile',
51
+ shape: 'pill',
52
+ theme: 'outline',
53
+ text: 'signin_with',
54
+ size: 'large',
55
+ logo_alignment: 'left'
56
+ }
57
+ );
58
+
59
+ });
60
+
61
+ const unlink = async () => {
62
+ await m("unlinkGoogle");
63
+ my.gmail = null;
64
+ window.location.reload();
65
+ }
66
+
67
+ </script>
68
+ <template>
69
+ <l-card :bordered="false">
70
+
71
+ <template v-if="app.googleClientId">
72
+ <q-card-section v-if="my.gmail">
73
+ You have already linked your Google account.<br />
74
+
75
+ Your gmail is {{ my.gmail }}
76
+
77
+
78
+
79
+ <l-btn label="Unlink" @click="unlink" icon="sym_o_delete"></l-btn>
80
+ </q-card-section>
81
+
82
+ <q-card-section v-else>
83
+ Click the button below to link your Google account.
84
+ <div id="g_id_signin"></div>
85
+ </q-card-section>
86
+ </template>
87
+
88
+ <q-card-section v-else>
89
+ Google login is not available. Please set GOOGLE_CLIENT_ID in server settings.
90
+ </q-card-section>
91
+
92
+ </l-card>
93
+ </template>
@@ -23,6 +23,8 @@ const route = useRoute()
23
23
  replace />
24
24
  <q-route-tab name="bio" icon="sym_o_fingerprint" :label="$t('Bio')" to="/User/setting/bio-auth"
25
25
  exact replace />
26
+ <q-route-tab name="openid" icon="sym_o_key" :label="$t('Open ID')" to="/User/setting/open_id" exact replace />
27
+
26
28
  </q-tabs>
27
29
  </template>
28
30
 
@@ -121,6 +121,11 @@ function User_setting_information() {
121
121
  /* webpackChunkName: "User-setting-information" */ './pages/User/setting/information.vue'
122
122
  )
123
123
  }
124
+ function User_setting_open_id() {
125
+ return import(
126
+ /* webpackChunkName: "User-setting-open_id" */ './pages/User/setting/open_id.vue'
127
+ )
128
+ }
124
129
  function User_setting_password() {
125
130
  return import(
126
131
  /* webpackChunkName: "User-setting-password" */ './pages/User/setting/password.vue'
@@ -317,6 +322,11 @@ export default [
317
322
  path: 'information',
318
323
  component: User_setting_information,
319
324
  },
325
+ {
326
+ name: 'User-setting-open_id',
327
+ path: 'open_id',
328
+ component: User_setting_open_id,
329
+ },
320
330
  {
321
331
  name: 'User-setting-password',
322
332
  path: 'password',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "0.0.75",
3
+ "version": "0.0.76",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": "@hostlink/nuxt-light",
6
6
  "license": "MIT",