adminforth 1.2.52 → 1.2.53
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/modules/restApi.js +15 -14
- package/dist/modules/styles.js +3 -1
- package/dist/spa/spa/src/App.vue +1 -1
- package/dist/spa/spa/src/components/Filters.vue +1 -1
- package/dist/spa/spa/src/components/ResourceForm.vue +1 -1
- package/dist/spa/spa/src/components/ResourceListTable.vue +5 -3
- package/modules/restApi.ts +3 -2
- package/modules/styles.ts +4 -1
- package/package.json +1 -1
- package/spa/src/App.vue +1 -1
- package/spa/src/components/Filters.vue +1 -1
- package/spa/src/components/ResourceForm.vue +1 -1
- package/spa/src/components/ResourceListTable.vue +5 -3
package/dist/modules/restApi.js
CHANGED
|
@@ -20,7 +20,7 @@ export default class AdminForthRestAPI {
|
|
|
20
20
|
method: 'POST',
|
|
21
21
|
path: '/login',
|
|
22
22
|
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, response }) {
|
|
23
|
-
var _b, _c, _d, _e
|
|
23
|
+
var _b, _c, _d, _e;
|
|
24
24
|
const INVALID_MESSAGE = 'Invalid username or password';
|
|
25
25
|
const { username, password } = body;
|
|
26
26
|
let adminUser;
|
|
@@ -28,7 +28,7 @@ export default class AdminForthRestAPI {
|
|
|
28
28
|
let token;
|
|
29
29
|
if (this.adminforth.config.rootUser
|
|
30
30
|
&& username === this.adminforth.config.rootUser.username
|
|
31
|
-
&& password ===
|
|
31
|
+
&& password === this.adminforth.config.rootUser.password) {
|
|
32
32
|
this.adminforth.auth.setAuthCookie({ response, username, pk: null });
|
|
33
33
|
adminUser = { isRoot: true, dbUser: null, pk: null, username: this.adminforth.config.rootUser.username };
|
|
34
34
|
}
|
|
@@ -48,7 +48,7 @@ export default class AdminForthRestAPI {
|
|
|
48
48
|
});
|
|
49
49
|
console.log('Adding passwordHashField to userResource', userResource);
|
|
50
50
|
}
|
|
51
|
-
const userRecord = (
|
|
51
|
+
const userRecord = (_b = (yield this.adminforth.connectors[userResource.dataSource].getData({
|
|
52
52
|
resource: userResource,
|
|
53
53
|
filters: [
|
|
54
54
|
{ field: this.adminforth.config.auth.usernameField, operator: AdminForthFilterOperators.EQ, value: username },
|
|
@@ -56,7 +56,7 @@ export default class AdminForthRestAPI {
|
|
|
56
56
|
limit: 1,
|
|
57
57
|
offset: 0,
|
|
58
58
|
sort: [],
|
|
59
|
-
})).data) === null ||
|
|
59
|
+
})).data) === null || _b === void 0 ? void 0 : _b[0];
|
|
60
60
|
if (!userRecord) {
|
|
61
61
|
return { error: 'User not found' };
|
|
62
62
|
}
|
|
@@ -72,8 +72,8 @@ export default class AdminForthRestAPI {
|
|
|
72
72
|
if (beforeLoginConfirmation === null || beforeLoginConfirmation === void 0 ? void 0 : beforeLoginConfirmation.length) {
|
|
73
73
|
for (const hook of beforeLoginConfirmation) {
|
|
74
74
|
const resp = yield hook({ adminUser, response });
|
|
75
|
-
if ((
|
|
76
|
-
toReturn = { ok: resp.ok, redirectTo: (
|
|
75
|
+
if ((_c = resp === null || resp === void 0 ? void 0 : resp.body) === null || _c === void 0 ? void 0 : _c.redirectTo) {
|
|
76
|
+
toReturn = { ok: resp.ok, redirectTo: (_d = resp === null || resp === void 0 ? void 0 : resp.body) === null || _d === void 0 ? void 0 : _d.redirectTo, allowedLogin: (_e = resp === null || resp === void 0 ? void 0 : resp.body) === null || _e === void 0 ? void 0 : _e.allowedLogin };
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -92,7 +92,7 @@ export default class AdminForthRestAPI {
|
|
|
92
92
|
server.endpoint({
|
|
93
93
|
method: 'POST',
|
|
94
94
|
path: '/check_auth',
|
|
95
|
-
handler: (
|
|
95
|
+
handler: (_f) => __awaiter(this, [_f], void 0, function* ({ adminUser }) {
|
|
96
96
|
return { ok: true };
|
|
97
97
|
}),
|
|
98
98
|
});
|
|
@@ -100,7 +100,7 @@ export default class AdminForthRestAPI {
|
|
|
100
100
|
noAuth: true,
|
|
101
101
|
method: 'POST',
|
|
102
102
|
path: '/logout',
|
|
103
|
-
handler: (
|
|
103
|
+
handler: (_g) => __awaiter(this, [_g], void 0, function* ({ response }) {
|
|
104
104
|
this.adminforth.auth.removeAuthCookie(response);
|
|
105
105
|
return { ok: true };
|
|
106
106
|
}),
|
|
@@ -109,8 +109,8 @@ export default class AdminForthRestAPI {
|
|
|
109
109
|
noAuth: true,
|
|
110
110
|
method: 'GET',
|
|
111
111
|
path: '/get_public_config',
|
|
112
|
-
handler: (
|
|
113
|
-
var
|
|
112
|
+
handler: (_h) => __awaiter(this, [_h], void 0, function* ({ body }) {
|
|
113
|
+
var _j;
|
|
114
114
|
// find resource
|
|
115
115
|
if (!this.adminforth.config.auth) {
|
|
116
116
|
throw new Error('No config.auth defined');
|
|
@@ -122,7 +122,7 @@ export default class AdminForthRestAPI {
|
|
|
122
122
|
brandName: this.adminforth.config.customization.brandName,
|
|
123
123
|
usernameFieldName: usernameColumn.label,
|
|
124
124
|
loginBackgroundImage: this.adminforth.config.auth.loginBackgroundImage,
|
|
125
|
-
title: (
|
|
125
|
+
title: (_j = this.adminforth.config.customization) === null || _j === void 0 ? void 0 : _j.title,
|
|
126
126
|
demoCredentials: this.adminforth.config.auth.demoCredentials,
|
|
127
127
|
loginPromptHTML: this.adminforth.config.auth.loginPromptHTML,
|
|
128
128
|
};
|
|
@@ -131,12 +131,13 @@ export default class AdminForthRestAPI {
|
|
|
131
131
|
server.endpoint({
|
|
132
132
|
method: 'GET',
|
|
133
133
|
path: '/get_base_config',
|
|
134
|
-
handler: (
|
|
135
|
-
var _m, _o;
|
|
134
|
+
handler: (_k) => __awaiter(this, [_k], void 0, function* ({ input, adminUser, cookies }) {
|
|
135
|
+
var _l, _m, _o;
|
|
136
136
|
let username = '';
|
|
137
137
|
let userFullName = '';
|
|
138
138
|
if (adminUser.isRoot) {
|
|
139
|
-
|
|
139
|
+
// isRoot can be in JWT token still when rootUser deleted, so we check for rootUser?"
|
|
140
|
+
username = ((_l = this.adminforth.config.rootUser) === null || _l === void 0 ? void 0 : _l.username) || 'RootUser';
|
|
140
141
|
}
|
|
141
142
|
else {
|
|
142
143
|
const dbUser = adminUser.dbUser;
|
package/dist/modules/styles.js
CHANGED
|
@@ -81,7 +81,9 @@ export const styles = () => ({
|
|
|
81
81
|
customLight: "0 4px 8px rgba(0, 0, 0, 0.1)", // Lighter shadow
|
|
82
82
|
headerShadow: "0 4px 8px rgba(0, 0, 0, 0.1)", // Lighter shadow
|
|
83
83
|
listTableShadow: "0 4px 8px rgba(0, 0, 0, 0.1)", // Lighter shadow
|
|
84
|
-
|
|
84
|
+
darkListTableShadow: "0 4px 8px rgba(0, 0, 0, 0.3)", // Lighter shadow
|
|
85
|
+
resourseFormShadow: "0 4px 8px rgba(0, 0, 0, 0.1)", // Lighter shadow
|
|
86
|
+
darkResourseFormShadow: "0 4px 8px rgba(0, 0, 0, 0.3)", // Lighter shadow
|
|
85
87
|
},
|
|
86
88
|
fontSize: {
|
|
87
89
|
"headerText-size": "1rem"
|
package/dist/spa/spa/src/App.vue
CHANGED
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
</aside>
|
|
110
110
|
|
|
111
111
|
|
|
112
|
-
<div class="sm:ml-64
|
|
112
|
+
<div class="sm:ml-64" v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady">
|
|
113
113
|
<div class="p-0 dark:border-gray-700 mt-14">
|
|
114
114
|
<RouterView/>
|
|
115
115
|
</div>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<!-- drawer component -->
|
|
3
3
|
<div id="drawer-navigation"
|
|
4
4
|
|
|
5
|
-
class="fixed right-0 z-50 p-4 overflow-y-auto transition-transform translate-x-full bg-white w-80 dark:bg-gray-800 shadow-xl dark:shadow-
|
|
5
|
+
class="fixed right-0 z-50 p-4 overflow-y-auto transition-transform translate-x-full bg-white w-80 dark:bg-gray-800 shadow-xl dark:shadow-gray-900"
|
|
6
6
|
|
|
7
7
|
:class="show ? 'top-0 transform-none' : ''"
|
|
8
8
|
tabindex="-1" aria-labelledby="drawer-navigation-label"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="rounded-default">
|
|
3
3
|
<div
|
|
4
|
-
class="relative shadow-resourseFormShadow sm:rounded-lg dark:shadow-2xl
|
|
4
|
+
class="relative shadow-resourseFormShadow dark:shadow-darkResourseFormShadow sm:rounded-lg dark:shadow-2xl rounded-default"
|
|
5
5
|
>
|
|
6
6
|
<form autocomplete="off" @submit.prevent>
|
|
7
7
|
<table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400 ">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<!-- table -->
|
|
3
|
-
<div class="relative overflow-x-auto shadow-listTableShadow dark:shadow-
|
|
3
|
+
<div class="relative overflow-x-auto shadow-listTableShadow dark:shadow-darkListTableShadow overflow-y-hidden rounded-default">
|
|
4
4
|
|
|
5
5
|
<!-- skelet loader -->
|
|
6
6
|
<div role="status" v-if="!resource || !resource.columns"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
</thead>
|
|
56
56
|
<tbody>
|
|
57
57
|
<SkeleteLoader v-if="!rows" :columns="3" :rows="resource?.columns.length + 2"/>
|
|
58
|
-
<tr v-else-if="rows.length === 0" class="bg-lightListTable
|
|
58
|
+
<tr v-else-if="rows.length === 0" class="bg-lightListTable dark:bg-darkListTable dark:border-darkListTableBorder">
|
|
59
59
|
<td :colspan="resource?.columns.length + 2">
|
|
60
60
|
|
|
61
61
|
<div id="toast-simple"
|
|
@@ -69,7 +69,9 @@
|
|
|
69
69
|
</tr>
|
|
70
70
|
|
|
71
71
|
<tr @click="onClick($event,row)" v-else v-for="(row, rowI) in rows" :key="row.id"
|
|
72
|
-
class="bg-lightListTable
|
|
72
|
+
class="bg-lightListTable dark:bg-darkListTable border-lightListBorder dark:border-gray-700 hover:bg-lightListTableRowHover dark:hover:bg-darkListTableRowHover cursor-pointer"
|
|
73
|
+
:class="{'border-b': rowI !== rows.length - 1}"
|
|
74
|
+
>
|
|
73
75
|
<td class="w-4 p-4 cursor-default" @click="(e)=>{e.stopPropagation()}">
|
|
74
76
|
<div class="flex items center ">
|
|
75
77
|
<input
|
package/modules/restApi.ts
CHANGED
|
@@ -44,7 +44,7 @@ export default class AdminForthRestAPI {
|
|
|
44
44
|
let token;
|
|
45
45
|
if (this.adminforth.config.rootUser
|
|
46
46
|
&& username === this.adminforth.config.rootUser.username
|
|
47
|
-
&& password === this.adminforth.config.rootUser
|
|
47
|
+
&& password === this.adminforth.config.rootUser.password
|
|
48
48
|
) {
|
|
49
49
|
this.adminforth.auth.setAuthCookie({ response, username, pk: null });
|
|
50
50
|
adminUser = { isRoot: true, dbUser: null, pk: null, username: this.adminforth.config.rootUser.username};
|
|
@@ -163,7 +163,8 @@ export default class AdminForthRestAPI {
|
|
|
163
163
|
let username = ''
|
|
164
164
|
let userFullName = ''
|
|
165
165
|
if (adminUser.isRoot) {
|
|
166
|
-
|
|
166
|
+
// isRoot can be in JWT token still when rootUser deleted, so we check for rootUser?"
|
|
167
|
+
username = this.adminforth.config.rootUser?.username || 'RootUser';
|
|
167
168
|
} else {
|
|
168
169
|
const dbUser = adminUser.dbUser;
|
|
169
170
|
username = dbUser[this.adminforth.config.auth.usernameField];
|
package/modules/styles.ts
CHANGED
|
@@ -97,7 +97,10 @@ export const styles = () => ({
|
|
|
97
97
|
customLight: "0 4px 8px rgba(0, 0, 0, 0.1)", // Lighter shadow
|
|
98
98
|
headerShadow: "0 4px 8px rgba(0, 0, 0, 0.1)", // Lighter shadow
|
|
99
99
|
listTableShadow: "0 4px 8px rgba(0, 0, 0, 0.1)", // Lighter shadow
|
|
100
|
-
|
|
100
|
+
darkListTableShadow: "0 4px 8px rgba(0, 0, 0, 0.3)", // Lighter shadow
|
|
101
|
+
resourseFormShadow: "0 4px 8px rgba(0, 0, 0, 0.1)", // Lighter shadow
|
|
102
|
+
darkResourseFormShadow: "0 4px 8px rgba(0, 0, 0, 0.3)", // Lighter shadow
|
|
103
|
+
|
|
101
104
|
},
|
|
102
105
|
fontSize: {
|
|
103
106
|
"headerText-size": "1rem"
|
package/package.json
CHANGED
package/spa/src/App.vue
CHANGED
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
</aside>
|
|
110
110
|
|
|
111
111
|
|
|
112
|
-
<div class="sm:ml-64
|
|
112
|
+
<div class="sm:ml-64" v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady">
|
|
113
113
|
<div class="p-0 dark:border-gray-700 mt-14">
|
|
114
114
|
<RouterView/>
|
|
115
115
|
</div>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<!-- drawer component -->
|
|
3
3
|
<div id="drawer-navigation"
|
|
4
4
|
|
|
5
|
-
class="fixed right-0 z-50 p-4 overflow-y-auto transition-transform translate-x-full bg-white w-80 dark:bg-gray-800 shadow-xl dark:shadow-
|
|
5
|
+
class="fixed right-0 z-50 p-4 overflow-y-auto transition-transform translate-x-full bg-white w-80 dark:bg-gray-800 shadow-xl dark:shadow-gray-900"
|
|
6
6
|
|
|
7
7
|
:class="show ? 'top-0 transform-none' : ''"
|
|
8
8
|
tabindex="-1" aria-labelledby="drawer-navigation-label"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="rounded-default">
|
|
3
3
|
<div
|
|
4
|
-
class="relative shadow-resourseFormShadow sm:rounded-lg dark:shadow-2xl
|
|
4
|
+
class="relative shadow-resourseFormShadow dark:shadow-darkResourseFormShadow sm:rounded-lg dark:shadow-2xl rounded-default"
|
|
5
5
|
>
|
|
6
6
|
<form autocomplete="off" @submit.prevent>
|
|
7
7
|
<table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400 ">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<!-- table -->
|
|
3
|
-
<div class="relative overflow-x-auto shadow-listTableShadow dark:shadow-
|
|
3
|
+
<div class="relative overflow-x-auto shadow-listTableShadow dark:shadow-darkListTableShadow overflow-y-hidden rounded-default">
|
|
4
4
|
|
|
5
5
|
<!-- skelet loader -->
|
|
6
6
|
<div role="status" v-if="!resource || !resource.columns"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
</thead>
|
|
56
56
|
<tbody>
|
|
57
57
|
<SkeleteLoader v-if="!rows" :columns="3" :rows="resource?.columns.length + 2"/>
|
|
58
|
-
<tr v-else-if="rows.length === 0" class="bg-lightListTable
|
|
58
|
+
<tr v-else-if="rows.length === 0" class="bg-lightListTable dark:bg-darkListTable dark:border-darkListTableBorder">
|
|
59
59
|
<td :colspan="resource?.columns.length + 2">
|
|
60
60
|
|
|
61
61
|
<div id="toast-simple"
|
|
@@ -69,7 +69,9 @@
|
|
|
69
69
|
</tr>
|
|
70
70
|
|
|
71
71
|
<tr @click="onClick($event,row)" v-else v-for="(row, rowI) in rows" :key="row.id"
|
|
72
|
-
class="bg-lightListTable
|
|
72
|
+
class="bg-lightListTable dark:bg-darkListTable border-lightListBorder dark:border-gray-700 hover:bg-lightListTableRowHover dark:hover:bg-darkListTableRowHover cursor-pointer"
|
|
73
|
+
:class="{'border-b': rowI !== rows.length - 1}"
|
|
74
|
+
>
|
|
73
75
|
<td class="w-4 p-4 cursor-default" @click="(e)=>{e.stopPropagation()}">
|
|
74
76
|
<div class="flex items center ">
|
|
75
77
|
<input
|