@hostlink/nuxt-light 1.18.2 → 1.19.0

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.
Files changed (32) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/L/ForgetPasswordDialog.vue +12 -14
  3. package/dist/runtime/components/L/System/Setting/authentication.vue +54 -0
  4. package/dist/runtime/components/L/System/Setting/modules.vue +1 -1
  5. package/dist/runtime/components/l-app-main.vue +10 -13
  6. package/dist/runtime/components/l-app.vue +31 -8
  7. package/dist/runtime/components/l-edit-btn.vue +1 -1
  8. package/dist/runtime/components/l-facebook-button.vue +28 -0
  9. package/dist/runtime/components/l-form-dialog.vue +1 -2
  10. package/dist/runtime/components/l-input.vue +14 -9
  11. package/dist/runtime/components/l-login.vue +66 -14
  12. package/dist/runtime/components/l-microsoft-button.vue +119 -0
  13. package/dist/runtime/components/l-page.vue +0 -1
  14. package/dist/runtime/components/l-tab.vue +4 -1
  15. package/dist/runtime/components/l-tabs.vue +2 -4
  16. package/dist/runtime/index.d.ts +1 -92
  17. package/dist/runtime/index.js +1 -197
  18. package/dist/runtime/lib/index.d.ts +1 -1
  19. package/dist/runtime/light.d.ts +1224 -0
  20. package/dist/runtime/light.js +242 -0
  21. package/dist/runtime/locales/zh-hk.json +29 -1
  22. package/dist/runtime/pages/System/database/table.vue +8 -10
  23. package/dist/runtime/pages/System/setting.vue +24 -2
  24. package/dist/runtime/pages/System/view_as.vue +3 -3
  25. package/dist/runtime/pages/User/_user_id/view.vue +6 -20
  26. package/dist/runtime/pages/User/setting/bio-auth.vue +34 -15
  27. package/dist/runtime/pages/User/setting/my_favorite.vue +2 -5
  28. package/dist/runtime/pages/User/setting/open_id.vue +169 -31
  29. package/dist/runtime/pages/User/setting/two-factor-auth.vue +2 -3
  30. package/dist/runtime/plugin.js +4 -1
  31. package/package.json +4 -2
  32. package/dist/runtime/components/L/ForgetPasswordResetDialog.vue +0 -34
@@ -1,10 +1,25 @@
1
1
  <script setup>
2
2
  import { reactive, onMounted, nextTick } from "vue"
3
3
  import { useQuasar } from "quasar";
4
- import { q, m, api } from '#imports'
4
+ import { q, m, useLight } from '#imports'
5
+ import { useI18n } from 'vue-i18n'
6
+
7
+ const light = useLight()
8
+ const { t } = useI18n()
5
9
  const quasar = useQuasar();
6
- let { app, my } = await q({ app: ['googleClientId'], my: ["gmail"] })
10
+ let { app, my } = await q({
11
+ app: {
12
+ googleClientId: true,
13
+ microsoftClientId: true,
14
+ facebookAppId: true,
15
+ }, my: {
16
+ google: true,
17
+ microsoft: true,
18
+ facebook: true,
19
+ }
20
+ })
7
21
 
22
+ const $q = useQuasar();
8
23
  my = reactive(my);
9
24
 
10
25
  const handleGoogleCredentialResponse = async (response) => {
@@ -12,13 +27,11 @@ const handleGoogleCredentialResponse = async (response) => {
12
27
  await m("googleRegister", { credential: response.credential })
13
28
 
14
29
  const resp = await q("my", ["gmail"]);
15
- my.gmail = resp.gmail;
30
+ my.google = resp.google;
16
31
 
17
- quasar.notify({
32
+ light.notify({
18
33
  message: "Google account linked",
19
34
  color: "positive",
20
- position: "top",
21
- timeout: 2000
22
35
  });
23
36
  } catch (e) {
24
37
  console.log(e)
@@ -67,35 +80,160 @@ onMounted(() => {
67
80
 
68
81
  });
69
82
 
70
- const unlink = async () => {
71
- await m("unlinkGoogle");
72
- my.gmail = null;
73
- window.location.reload();
83
+ const onUnlink = async () => {
84
+
85
+ //confirm
86
+ light.dialog({
87
+ title: "Unlink",
88
+ color: "negative",
89
+ message: "Are you sure you want to unlink your Google account?",
90
+ ok: "Yes",
91
+ cancel: "No",
92
+ }).onOk(async () => {
93
+ await m("unlinkGoogle");
94
+ my.gmail = null;
95
+ window.location.reload();
96
+ })
97
+ }
98
+
99
+ const ms = reactive({});
100
+
101
+ const onUnlinkMicrosoft = async () => {
102
+ //confirm
103
+ light.dialog({
104
+ title: "Unlink",
105
+ color: "negative",
106
+ message: "Are you sure you want to unlink your Microsoft account?",
107
+ ok: "Yes",
108
+ cancel: "No",
109
+ }).onOk(async () => {
110
+ await m("unlinkMicrosoft");
111
+ my.microsoft = null;
112
+ window.location.reload();
113
+ })
114
+ }
115
+
116
+ const onLinkMicrosoft = async (resp) => {
117
+ try {
118
+ await m("microsoftRegister", { account_id: resp.account.localAccountId });
119
+ light.notify({
120
+ message: "Microsoft account linked",
121
+ color: "positive",
122
+ });
123
+
124
+ window.location.reload();
125
+ } catch (e) {
126
+ light.notify({
127
+ message: e.message,
128
+ color: "negative",
129
+ });
130
+ }
131
+ }
132
+
133
+ const onLinkFacebook = (accessToken) => {
134
+ try {
135
+ m("facebookRegister", { access_token: accessToken })
136
+ light.notify({
137
+ message: "Facebook account linked",
138
+ color: "positive",
139
+ });
140
+ } catch (e) {
141
+ light.notify({
142
+ message: e.message,
143
+ color: "negative",
144
+ });
145
+ }
146
+
147
+ }
148
+
149
+ const onUnlinkFacebook = async () => {
150
+ //confirm
151
+ light.dialog({
152
+ title: "Unlink",
153
+ color: "negative",
154
+ message: "Are you sure you want to unlink your Facebook account?",
155
+ ok: "Yes",
156
+ cancel: "No",
157
+ }).onOk(async () => {
158
+ await m("unlinkFacebook");
159
+ my.facebook = null;
160
+ window.location.reload();
161
+ })
74
162
  }
75
163
 
76
164
  </script>
77
165
  <template>
78
- <l-card :bordered="false">
79
-
80
- <template v-if="app.googleClientId">
81
- <q-card-section v-if="my.gmail">
82
- <p>
83
- You have already linked your Google account.<br />
84
-
85
- Your gmail is {{ my.gmail }}
86
- </p>
87
- <l-btn label="Unlink" @click="unlink" icon="sym_o_delete"></l-btn>
88
- </q-card-section>
89
-
90
- <q-card-section v-else>
91
- Click the button below to link your Google account.
92
- <div id="g_id_signin"></div>
93
- </q-card-section>
94
- </template>
95
-
96
- <q-card-section v-else>
97
- Google login is not available. Please set GOOGLE_CLIENT_ID in server settings.
166
+ <q-card :bordered="false">
167
+ <q-card-section>
168
+ <h2 class="text-h6">Google</h2>
169
+ <template v-if="app.googleClientId">
170
+ <template v-if="my.google">
171
+
172
+ {{ $t('You have already linked your Google account.') }}<br />
173
+ Your gmail id is {{ my.google }}<br />
174
+ <l-btn label="Unlink" @click="onUnlink" icon="sym_o_link_off"></l-btn>
175
+
176
+ </template>
177
+
178
+ <template v-else>
179
+ {{ $t('Click the button below to link your Google account.') }}
180
+ <div id="g_id_signin"></div>
181
+ </template>
182
+ </template>
183
+
184
+ <template v-else>
185
+ Google login is not available. Please set authentication google client id in server settings.
186
+ </template>
98
187
  </q-card-section>
99
188
 
100
- </l-card>
189
+
190
+ <q-separator />
191
+
192
+ <q-card-section>
193
+ <h2 class="text-h6">Microsoft</h2>
194
+ <template v-if="app.microsoftClientId">
195
+ <template v-if="my.microsoft">
196
+ {{ $t('You have already linked your Microsoft account.') }}<br />
197
+ Your account id is {{ my.microsoft }}
198
+ <br />
199
+ <l-btn label="Unlink" @click="onUnlinkMicrosoft" icon="sym_o_link_off"></l-btn>
200
+ </template>
201
+ <template v-else>
202
+ <div>{{ $t('Click the button below to link your Microsoft account.') }}</div>
203
+ <div>
204
+ <l-microsoft-button :client-id="app.microsoftClientId" @login="onLinkMicrosoft" />
205
+ </div>
206
+ </template>
207
+ </template>
208
+ <template v-else>
209
+ Micorsoft login is not available. Please set authentication microsft client id in server settings.
210
+ </template>
211
+ </q-card-section>
212
+
213
+
214
+ <q-separator />
215
+ <q-card-section>
216
+ <h2 class="text-h6">Facebook</h2>
217
+ <template v-if="app.facebookAppId">
218
+ <template v-if="my.facebook">
219
+ {{ $t('You have already linked your Facebook account.') }}<br />
220
+ Your account id is {{ my.facebook }}
221
+ <l-btn label="Unlink" @click="onUnlinkFacebook" icon="sym_o_link_off"></l-btn>
222
+ </template>
223
+ <template v-else>
224
+ <div>{{ $t('Click the button below to link your Facebook account.') }}</div>
225
+ <l-facebook-button @login="onLinkFacebook" />
226
+ </template>
227
+ </template>
228
+ <template v-else>
229
+ Facebook login is not available. Please set authentication facebook app id in server settings.
230
+ </template>
231
+ </q-card-section>
232
+
233
+
234
+
235
+
236
+
237
+
238
+ </q-card>
101
239
  </template>
@@ -48,8 +48,7 @@ const onCopy = () => {
48
48
  <l-form @submit="save" :bordered="false" v-if="show">
49
49
  <div>
50
50
  <p>
51
- Now download the app and scan the qrcode. Input the code to the
52
- following input and submit
51
+ {{ $t('Now download the app and scan the qrcode. Input the code to the following input and submit') }}
53
52
  </p>
54
53
  <p>
55
54
  For Android user, install
@@ -84,7 +83,7 @@ const onCopy = () => {
84
83
  </p>
85
84
 
86
85
  <l-input v-model="obj.code" label="Code"
87
- hint="Please scan the QR code with your authenticator app, and enter the code" required />
86
+ hint="Please scan the QR code with your authenticator app, and enter the code generated" required />
88
87
  </l-form>
89
88
  <div v-else>
90
89
  <q-card-section>
@@ -1,5 +1,6 @@
1
1
  import { Quasar, Dialog, Notify, Loading, AppFullscreen } from "quasar";
2
2
  import { createI18n } from "vue-i18n";
3
+ import { createLight } from "./light.js";
3
4
  import { defineNuxtPlugin } from "#app";
4
5
  import "./assets/main.css";
5
6
  import message_en from "./locales/en.json";
@@ -23,7 +24,6 @@ export default defineNuxtPlugin((nuxtApp) => {
23
24
  api.models.create("SystemValue", TypeSystemValue);
24
25
  api.models.create("MailLog", TypeMailLog);
25
26
  api.models.create("EventLog", TypeEventLog);
26
- nuxtApp.vueApp.config.globalProperties.$light = useLight();
27
27
  nuxtApp.vueApp.config.errorHandler = (err, instance, info) => {
28
28
  console.log(err);
29
29
  const light = useLight();
@@ -44,6 +44,9 @@ export default defineNuxtPlugin((nuxtApp) => {
44
44
  fallbackWarn: false,
45
45
  missingWarn: false
46
46
  });
47
+ nuxtApp.vueApp.use(createLight({
48
+ i18n
49
+ }));
47
50
  nuxtApp.vueApp.use(i18n);
48
51
  nuxtApp.vueApp.use(Quasar, {
49
52
  config: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.18.2",
3
+ "version": "1.19.0",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,8 +32,9 @@
32
32
  "test:watch": "vitest watch"
33
33
  },
34
34
  "dependencies": {
35
+ "@azure/msal-browser": "^3.26.1",
35
36
  "@formkit/drag-and-drop": "^0.1.6",
36
- "@hostlink/light": "^2.0.2",
37
+ "@hostlink/light": "^2.1.0",
37
38
  "@nuxt/kit": "^3.7.4",
38
39
  "@nuxt/module-builder": "^0.8.3",
39
40
  "@quasar/extras": "^1.16.11",
@@ -47,6 +48,7 @@
47
48
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz"
48
49
  },
49
50
  "devDependencies": {
51
+ "@azure/identity": "^4.5.0",
50
52
  "@nuxt/devtools": "latest",
51
53
  "@nuxt/eslint-config": "^0.2.0",
52
54
  "@nuxt/schema": "^3.7.4",
@@ -1,34 +0,0 @@
1
- <script setup lang="ts">
2
- import { useQuasar, useDialogPluginComponent } from 'quasar'
3
- import { m, api } from '#imports';
4
- const $q = useQuasar()
5
- const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } = useDialogPluginComponent()
6
-
7
- defineProps({
8
- username: String,
9
- code: String
10
- })
11
-
12
- </script>
13
- <template>
14
- <q-dialog ref="dialogRef">
15
- <q-card class="q-dialog-plugin">
16
- <q-card-section class="q-dialog__title">
17
- Reset password
18
- </q-card-section>
19
-
20
- <q-card-section class="q-dialog__message">
21
- Please enter your new password
22
- </q-card-section>
23
-
24
- <q-card-section>
25
- <form-kit type="form" :actions="false">
26
- <form-kit type="l-input" name="password" :stack-label="true"></form-kit>
27
- </form-kit>
28
- </q-card-section>
29
-
30
-
31
-
32
- </q-card>
33
- </q-dialog>
34
- </template>