@hostlink/nuxt-light 1.19.2 → 1.20.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.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "1.19.2",
4
+ "version": "1.20.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
@@ -6,12 +6,6 @@ const $q = useQuasar()
6
6
 
7
7
  const emits = defineEmits(["submit"])
8
8
 
9
- const { authorizationUrl } = await q({
10
- authorizationUrl: true
11
- })
12
-
13
- console.log(authorizationUrl);
14
-
15
9
  withDefaults(defineProps<{
16
10
  mail_driver: string,
17
11
  mail_host: string
@@ -29,14 +23,15 @@ withDefaults(defineProps<{
29
23
 
30
24
  const onLoginGmail = () => {
31
25
  let state = encodeURIComponent(window.self.location.origin + window.self.location.pathname + "?mail_driver=gmail");
32
- let url = "https://accounts.google.com/o/oauth2/v2/auth?scope=openid%20email%20profile%20https%3A%2F%2Fmail.google.com%2F&access_type=offline&state=" + state + "&response_type=code&redirect_uri=https%3A%2F%2Fraymond4.hostlink.com.hk%2Flight%2Fgmail_notification%2Fredirect.php&client_id=790028313082-8qqnoqvkqtqssufto11k6qe6pnievcpv.apps.googleusercontent.com&prompt=consent";
26
+
27
+ let scope = encodeURIComponent("https://mail.google.com/");
28
+ let url = "https://accounts.google.com/o/oauth2/v2/auth?scope=" + scope + "&access_type=offline&state=" + state + "&response_type=code&redirect_uri=https%3A%2F%2Fraymond4.hostlink.com.hk%2Flight%2Fgmail_notification%2Fredirect.php&client_id=790028313082-8qqnoqvkqtqssufto11k6qe6pnievcpv.apps.googleusercontent.com&prompt=consent";
33
29
  window.open(url, "_blank");
34
30
  }
35
31
 
36
32
  </script>
37
33
  <template>
38
34
  <FormKit type="l-form" :bordered="false" :value="$props" @submit="$emit('submit', $event)" #default="{ value }">
39
- {{ authorizationUrl }}
40
35
 
41
36
  <FormKit type="l-select" label="Mail Driver" name="mail_driver" :options="[{
42
37
  label: 'Mail', value: 'mail'
@@ -1,8 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { q, m } from '#imports'
3
- import { useQuasar } from 'quasar'
4
-
5
- const $q = useQuasar()
2
+ const emits = defineEmits(["submit"])
6
3
 
7
4
  export type LSystemSettingSecurityProps = {
8
5
  password_contains_uppercase: string
@@ -14,46 +11,30 @@ export type LSystemSettingSecurityProps = {
14
11
  auth_lockout_duration: string
15
12
  auth_lockout_attempts: string
16
13
  access_token_expire: string
14
+ password_expiration: string,
15
+ password_expiration_duration: string
17
16
  }
18
17
 
19
- const modelValue = defineModel<LSystemSettingSecurityProps>({
20
- required: true
21
- })
22
-
23
- const onSubmit = async (d: LSystemSettingSecurityProps) => {
24
- let data: { name: string, value: string }[] = []
18
+ withDefaults(defineProps<LSystemSettingSecurityProps>(), {
19
+ password_contains_uppercase: "0",
20
+ password_contains_lowercase: "0",
21
+ password_contains_numeric: "0",
22
+ password_contains_symbol: "0",
23
+ password_min_length: "8",
24
+ two_factor_authentication: "0",
25
+ auth_lockout_duration: "15",
26
+ auth_lockout_attempts: "5",
27
+ access_token_expire: "28800",
28
+ password_expiration: "0",
29
+ password_expiration_duration: "90"
30
+ });
25
31
 
26
- Object.keys(d).forEach((key) => {
27
- data.push({
28
- name: key,
29
- value: d[key as keyof LSystemSettingSecurityProps]
30
- })
31
- })
32
- await m("updateAppConfigs", { data })
33
- //update the modelValue
34
- Object.keys(d).forEach((key) => {
35
- modelValue.value[key as keyof LSystemSettingSecurityProps] = d[key as keyof LSystemSettingSecurityProps]
36
- })
37
-
38
- $q.notify({ message: "Settings saved", color: "positive" })
39
- }
40
32
 
41
33
  </script>
42
34
 
43
35
  <template>
44
36
 
45
- <FormKit type="l-form" :bordered="false" :value="{
46
- password_contains_uppercase: modelValue.password_contains_uppercase,
47
- password_contains_lowercase: modelValue.password_contains_lowercase,
48
- password_contains_numeric: modelValue.password_contains_numeric,
49
- password_contains_symbol: modelValue.password_contains_symbol,
50
- password_min_length: modelValue.password_min_length,
51
- two_factor_authentication: modelValue.two_factor_authentication,
52
- auth_lockout_duration: modelValue.auth_lockout_duration,
53
- auth_lockout_attempts: modelValue.auth_lockout_attempts,
54
- access_token_expire: modelValue.access_token_expire,
55
-
56
- }" @submit="onSubmit">
37
+ <FormKit type="l-form" :bordered="false" :value="$props" @submit="$emit('submit',$event)">
57
38
  <q-field label="Password policy" stack-label :color="$light.color">
58
39
  <FormKit type="l-checkbox" label="Upper Case" name="password_contains_uppercase" true-value="1"
59
40
  false-value="0" />
@@ -84,11 +65,9 @@ const onSubmit = async (d: LSystemSettingSecurityProps) => {
84
65
  validation="required" />
85
66
 
86
67
 
87
- <!-- form-kit label="Password expiration" true-value="1" false-value="0" name="password_expiration"
68
+ <form-kit label="Password expiration" true-value="1" false-value="0" name="password_expiration"
88
69
  type="l-checkbox"></form-kit>
89
-
90
-
91
70
  <form-kit label="Password expiration duration" name="password_expiration_duration" type="l-input"
92
- hint="The number of days before the password expires. Default is 90 days." validation="required"></form-kit -->
71
+ hint="The number of days before the password expires. Default is 90 days." validation="required"></form-kit>
93
72
  </FormKit>
94
73
  </template>
@@ -34,6 +34,39 @@ const data = reactive({
34
34
 
35
35
  const $q = useQuasar()
36
36
 
37
+ const passwordExpiredProcess = (username: string, password: string) => {
38
+ $q.dialog({
39
+ title: t("Password expired"),
40
+ message: t("Your password has expired, please enter your new password"),
41
+ prompt: {
42
+ model: "",
43
+ type: "password",
44
+ required: true
45
+ },
46
+ cancel: true,
47
+ persistent: true
48
+ }).onOk(async newPassword => {
49
+ try {
50
+ await api.auth.changeExpiredPassword(username, password, newPassword);
51
+ $q.notify({
52
+ message: t("Your password has been changed successfully, please login again"),
53
+ color: "positive",
54
+ icon: "sym_o_check",
55
+ });
56
+ } catch (e) {
57
+ $q.notify({
58
+ message: e.message,
59
+ color: "negative",
60
+ icon: "sym_o_error",
61
+ });
62
+ passwordExpiredProcess(username, password);
63
+ }
64
+ });
65
+
66
+
67
+
68
+ }
69
+
37
70
  const loginWithCode = (username: string, password: string) => {
38
71
  $q.dialog({
39
72
  title: t("Enter your code"),
@@ -58,9 +91,6 @@ const loading = ref(false);
58
91
 
59
92
  const submit = async () => {
60
93
  if (await form1.value.validate()) {
61
-
62
-
63
-
64
94
  try {
65
95
  loading.value = true;
66
96
  await api.auth.login(data.username, data.password, data.code)
@@ -71,11 +101,15 @@ const submit = async () => {
71
101
  data.code = "";
72
102
 
73
103
  if (e.message == "two factor authentication code is required") {
74
-
75
104
  loginWithCode(data.username, data.password);
76
105
  return;
77
106
  }
78
107
 
108
+ if (e.message == "password is expired") {
109
+ passwordExpiredProcess(data.username, data.password);
110
+ return;
111
+ }
112
+
79
113
  $q.notify({
80
114
  message: e.message,
81
115
  color: "negative",
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { getObject } from "#imports"
3
- const obj = await getObject(["eventlog_id", "class", "id", "action", "created_time", "username", "source", "target"]);
3
+ const obj = await getObject(["eventlog_id", "class", "id", "action", "created_time", "username", "source", "target", "different"]);
4
4
 
5
5
  const splitterModel = 50;
6
6
  </script>
@@ -17,7 +17,7 @@ const splitterModel = 50;
17
17
 
18
18
  </l-list>
19
19
 
20
- <q-splitter v-model="splitterModel" >
20
+ <q-splitter v-model="splitterModel">
21
21
  <template v-slot:before>
22
22
  <div class="q-pa-md">
23
23
  <div class="text-h6 q-mb-md">{{ $t('Source') }}</div>
@@ -28,12 +28,16 @@ const splitterModel = 50;
28
28
  <template v-slot:after>
29
29
  <div class="q-pa-md">
30
30
  <div class="text-h6 q-mb-md">{{ $t('Target') }}</div>
31
- <pre>{{ obj.target }}
32
- </pre>
33
-
31
+ <pre>{{ obj.target }}</pre>
34
32
  </div>
35
33
  </template>
36
34
  </q-splitter>
35
+
36
+ <q-separator />
37
+ <div class="q-pa-md" style="overflow: auto;">
38
+ <div class="text-h6 q-mb-md">{{ $t('Different') }}</div>
39
+ <pre>{{ obj.different }}</pre>
40
+ </div>
37
41
  </l-card>
38
42
 
39
43
  </l-page>
@@ -1,6 +1,10 @@
1
1
  <script setup>
2
2
  import { q } from '#imports'
3
- const system = await q("system", ["server"])
3
+ const { system } = await q({
4
+ system: {
5
+ server: true
6
+ }
7
+ })
4
8
 
5
9
  const columns = [
6
10
  {
@@ -18,6 +22,7 @@ const columns = [
18
22
  </script>
19
23
  <template>
20
24
  <l-page>
21
- <l-table searchable :rows="system.server" :columns="columns" :rows-per-page-options="[0]" hide-pagination></l-table>
25
+ <l-table searchable :rows="system.server" :columns="columns" :rows-per-page-options="[0]"
26
+ hide-pagination></l-table>
22
27
  </l-page>
23
28
  </template>
@@ -1,8 +1,16 @@
1
1
  <script setup>
2
- import { m } from '#imports'
2
+ import { m, q } from '#imports'
3
3
  import { useQuasar } from "quasar"
4
4
  const quasar = useQuasar();
5
5
 
6
+ //get your email
7
+
8
+ const { my } = await q({
9
+ my: {
10
+ email: true
11
+ }
12
+ });
13
+
6
14
  const onSubmit = async (data) => {
7
15
  try {
8
16
  await m("mailTest", data)
@@ -26,6 +34,7 @@ const onSubmit = async (data) => {
26
34
  <template>
27
35
  <l-page>
28
36
  <form-kit type="l-form" @submit="onSubmit" :value="{
37
+ email: my.email,
29
38
  subject: 'Test email',
30
39
  content: 'Hello, this is a test email'
31
40
  }">
@@ -75,7 +75,7 @@ const onSubmit = async (d) => {
75
75
  <template #after>
76
76
  <l-system-setting-general v-if="tab == 'general'" v-model="obj" />
77
77
  <l-system-setting-mail v-if="tab == 'mail'" v-bind="obj" @submit="onSubmit" />
78
- <l-system-setting-security v-if="tab == 'security'" v-model="obj" />
78
+ <l-system-setting-security v-if="tab == 'security'" v-bind="obj" @submit="onSubmit" />
79
79
  <l-system-setting-modules v-if="tab == 'Modules'" v-model="obj" />
80
80
  <l-system-setting-developer v-if="tab == 'developer'" v-model="obj" />
81
81
  <l-system-setting-forget-password v-if="tab == 'forget-password'" v-model="obj" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.19.2",
3
+ "version": "1.20.0",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,7 +34,7 @@
34
34
  "dependencies": {
35
35
  "@azure/msal-browser": "^3.26.1",
36
36
  "@formkit/drag-and-drop": "^0.1.6",
37
- "@hostlink/light": "^2.1.0",
37
+ "@hostlink/light": "^2.2.0",
38
38
  "@nuxt/kit": "^3.7.4",
39
39
  "@nuxt/module-builder": "^0.8.3",
40
40
  "@quasar/extras": "^1.16.11",