express-sweet-generator 1.0.2 → 1.0.5
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/CHANGELOG.md +36 -2
- package/README.md +14 -42
- package/bin/express-sweet-cli.js +220 -217
- package/package.json +1 -1
- package/templates/cjs/config/authentication.js +15 -1
- package/templates/cjs/config/database.js +6 -12
- package/templates/cjs/config/view.js +15 -1
- package/templates/cjs/ecosystem.config.js.ejs +5 -1
- package/templates/cjs/public/assets/home.css +0 -0
- package/templates/cjs/public/assets/home.js +0 -0
- package/templates/cjs/public/assets/{styles/login.css → login.css} +0 -2
- package/templates/cjs/public/assets/{scripts/login.js → login.js} +0 -3
- package/templates/cjs/public/assets/{images/logo.svg → logo.svg} +0 -0
- package/templates/cjs/public/assets/user.css +0 -0
- package/templates/cjs/public/assets/{scripts/user.js → user.js} +0 -3
- package/templates/cjs/public/assets/users.css +0 -0
- package/templates/cjs/public/assets/{scripts/users.js → users.js} +11 -9
- package/templates/cjs/routes/api/users.js +7 -33
- package/templates/cjs/routes/home.js +0 -3
- package/templates/cjs/routes/login.js +0 -3
- package/templates/cjs/routes/users.js +3 -9
- package/templates/cjs/views/error.hbs +1 -2
- package/templates/cjs/views/home.hbs +2 -8
- package/templates/cjs/views/layout/default.hbs +13 -18
- package/templates/cjs/views/login.hbs +4 -15
- package/templates/cjs/views/user.hbs +9 -16
- package/templates/cjs/views/users.hbs +5 -17
- package/templates/esm/config/authentication.js +15 -0
- package/templates/esm/config/database.js +6 -12
- package/templates/esm/config/view.js +15 -1
- package/templates/esm/ecosystem.config.js.ejs +5 -1
- package/templates/esm/public/assets/home.css +0 -0
- package/templates/esm/public/assets/home.js +0 -0
- package/templates/esm/public/assets/{styles/login.css → login.css} +0 -2
- package/templates/esm/public/assets/{scripts/login.js → login.js} +0 -3
- package/templates/esm/public/assets/{images/logo.svg → logo.svg} +0 -0
- package/templates/esm/public/assets/user.css +0 -0
- package/templates/esm/public/assets/{scripts/user.js → user.js} +0 -3
- package/templates/esm/public/assets/users.css +0 -0
- package/templates/esm/public/assets/{scripts/users.js → users.js} +11 -9
- package/templates/esm/routes/api/users.js +7 -33
- package/templates/esm/routes/home.js +0 -3
- package/templates/esm/routes/login.js +0 -3
- package/templates/esm/routes/users.js +3 -9
- package/templates/esm/views/error.hbs +1 -2
- package/templates/esm/views/home.hbs +2 -8
- package/templates/esm/views/layout/default.hbs +13 -18
- package/templates/esm/views/login.hbs +4 -15
- package/templates/esm/views/user.hbs +9 -16
- package/templates/esm/views/users.hbs +5 -17
- package/templates/cjs/public/assets/images/logo-dark.svg +0 -12
- package/templates/cjs/public/assets/scripts/docs.js +0 -1
- package/templates/cjs/public/assets/scripts/home.js +0 -3
- package/templates/cjs/public/assets/styles/docs.css +0 -2200
- package/templates/cjs/public/assets/styles/home.css +0 -1
- package/templates/cjs/public/assets/styles/user.css +0 -1
- package/templates/cjs/public/assets/styles/users.css +0 -1
- package/templates/esm/public/assets/images/logo-dark.svg +0 -12
- package/templates/esm/public/assets/scripts/docs.js +0 -1
- package/templates/esm/public/assets/scripts/home.js +0 -3
- package/templates/esm/public/assets/styles/docs.css +0 -2200
- package/templates/esm/public/assets/styles/home.css +0 -1
- package/templates/esm/public/assets/styles/user.css +0 -1
- package/templates/esm/public/assets/styles/users.css +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const UserModel = require('../models/UserModel');
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* User authentication configuration interface.
|
|
6
5
|
*/
|
|
@@ -11,6 +10,21 @@ module.exports = {
|
|
|
11
10
|
*/
|
|
12
11
|
enabled: true,
|
|
13
12
|
|
|
13
|
+
/**
|
|
14
|
+
* The session store instance, defaults to a new MemoryStore(memory) instance.
|
|
15
|
+
* @type {'memory|redis'}
|
|
16
|
+
*/
|
|
17
|
+
session_store: 'memory',
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* If the session is stored in "redis", this field is required and should be set to the hostname of the Redis server.
|
|
21
|
+
* For example, to connect to redis on localhost on port 6379, set "redis://localhost:6379".
|
|
22
|
+
* To connect to a different host or port, use a connection string in the format "redis[s]://[[username][:password]@][host][:port][/db-number]".
|
|
23
|
+
* For example, "redis://alice:foobared@awesome.redis.server:6380".
|
|
24
|
+
* @type {string|undefined}
|
|
25
|
+
*/
|
|
26
|
+
redis_host: undefined,
|
|
27
|
+
|
|
14
28
|
/**
|
|
15
29
|
* Authentication user ID field name, defaults to `username`.
|
|
16
30
|
* @type {string}
|
|
@@ -4,38 +4,32 @@
|
|
|
4
4
|
module.exports = {
|
|
5
5
|
development: {
|
|
6
6
|
username: 'root',
|
|
7
|
-
password:
|
|
8
|
-
database: '
|
|
7
|
+
password: 'password',
|
|
8
|
+
database: 'mydb',
|
|
9
9
|
host: 'localhost',
|
|
10
10
|
port: undefined,
|
|
11
11
|
dialect: 'mariadb',
|
|
12
12
|
timezone: '+09:00',
|
|
13
13
|
logging: false
|
|
14
|
-
//,timezone: 'Etc/GMT-9'
|
|
15
|
-
//,dialectOptions: {useUTC: false, timezone: 'Etc/GMT-9'}
|
|
16
14
|
},
|
|
17
15
|
test: {
|
|
18
16
|
username: 'root',
|
|
19
|
-
password:
|
|
20
|
-
database: '
|
|
17
|
+
password: 'password',
|
|
18
|
+
database: 'mydb',
|
|
21
19
|
host: 'localhost',
|
|
22
20
|
port: undefined,
|
|
23
21
|
dialect: 'mariadb',
|
|
24
22
|
timezone: '+09:00',
|
|
25
23
|
logging: false
|
|
26
|
-
//,timezone: 'Etc/GMT-9'
|
|
27
|
-
//,dialectOptions: {useUTC: false, timezone: 'Etc/GMT-9'}
|
|
28
24
|
},
|
|
29
25
|
production: {
|
|
30
26
|
username: 'root',
|
|
31
|
-
password:
|
|
32
|
-
database: '
|
|
27
|
+
password: 'password',
|
|
28
|
+
database: 'mydb',
|
|
33
29
|
host: 'localhost',
|
|
34
30
|
port: undefined,
|
|
35
31
|
dialect: 'mariadb',
|
|
36
32
|
timezone: '+09:00',
|
|
37
33
|
logging: false
|
|
38
|
-
//,timezone: 'Etc/GMT-9'
|
|
39
|
-
//,dialectOptions: {useUTC: false, timezone: 'Etc/GMT-9'}
|
|
40
34
|
}
|
|
41
35
|
}
|
|
@@ -32,5 +32,19 @@ module.exports = {
|
|
|
32
32
|
* Extension for templates & partials, defaults to `.hbs`,
|
|
33
33
|
* @type {string}
|
|
34
34
|
*/
|
|
35
|
-
extension: '.hbs'
|
|
35
|
+
extension: '.hbs',
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Hook function just before the view is rendered.
|
|
39
|
+
* For example, you can set your own local variables that can be used within the view.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* // The message set here can be referenced in the view as {{message}}.
|
|
43
|
+
* beforeRender: res => {
|
|
44
|
+
* res.loclas.message = 'Hello World';
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
* @type {(res: express.Response) => void}
|
|
48
|
+
*/
|
|
49
|
+
beforeRender: (res) => {}
|
|
36
50
|
}
|
|
@@ -8,7 +8,11 @@ module.exports = {
|
|
|
8
8
|
exec_mode: 'cluster_mode',
|
|
9
9
|
watch: '.',
|
|
10
10
|
watch_delay: 3000,
|
|
11
|
-
ignore_watch : [
|
|
11
|
+
ignore_watch : [
|
|
12
|
+
'node_modules',
|
|
13
|
+
'public',
|
|
14
|
+
'views'
|
|
15
|
+
],
|
|
12
16
|
watch_options: {
|
|
13
17
|
followSymlinks: false,
|
|
14
18
|
usePolling: true
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/*User list page script*/
|
|
2
|
-
|
|
3
|
-
// Main processing.
|
|
4
1
|
// Set up data table.
|
|
5
2
|
const dt = $('#table')
|
|
6
3
|
.on('draw.dt', () => {
|
|
@@ -14,23 +11,28 @@ const dt = $('#table')
|
|
|
14
11
|
// URL to get list data.
|
|
15
12
|
url: '/api/users',
|
|
16
13
|
// Set action column elements.
|
|
17
|
-
dataSrc: res =>
|
|
14
|
+
dataSrc: res => {
|
|
15
|
+
return res.data.map(row => Object.assign(row, {actions: ''}));
|
|
16
|
+
},
|
|
18
17
|
// For Ajax, send a cookie.
|
|
19
|
-
xhrFields: {
|
|
18
|
+
xhrFields: {
|
|
19
|
+
withCredentials: true
|
|
20
|
+
}
|
|
20
21
|
},
|
|
21
22
|
columns: [
|
|
22
|
-
{data: 'id', width:
|
|
23
|
+
{data: 'id', width: 100},
|
|
23
24
|
{data: 'email'},
|
|
24
25
|
{data: 'name'},
|
|
25
26
|
{data: 'modified', width: 200},
|
|
26
|
-
{data: 'actions', width:
|
|
27
|
+
{data: 'actions', width: 200}
|
|
27
28
|
],
|
|
28
29
|
columnDefs: [
|
|
29
30
|
{
|
|
30
31
|
targets: -1,
|
|
31
32
|
orderable: false,
|
|
32
|
-
render: (data, type, row) =>
|
|
33
|
-
|
|
33
|
+
render: (data, type, row) =>
|
|
34
|
+
`<a href="/users/${row.id}" class="btn btn-success">Edit</a>
|
|
35
|
+
<button on-delete data-id="${row.id}" type="button" class="btn btn-danger mx-2">Delete</button>`
|
|
34
36
|
}
|
|
35
37
|
],
|
|
36
38
|
dom: `<'row'<'col-12'f>><'row'<'col-12'tr>><'row'<'col-12 dataTables_pager'p>>`,
|
|
@@ -3,34 +3,19 @@ const router = express.Router();
|
|
|
3
3
|
const UserModel = require('../../models/UserModel');
|
|
4
4
|
const Authentication = require('express-sweet').services.Authentication;
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
* Login.
|
|
8
|
-
*/
|
|
6
|
+
// Login.
|
|
9
7
|
router.post('/login', async (req, res, next) => {
|
|
10
|
-
// Authenticate with username and password.
|
|
11
8
|
const isAuthenticated = await Authentication.authenticate(req, res, next);
|
|
12
|
-
|
|
13
|
-
// For asynchronous requests.Returns the authentication result and executes subsequent processing on the front end.
|
|
14
9
|
res.json(isAuthenticated);
|
|
15
|
-
|
|
16
|
-
// // For sync request.If the authentication is successful, you will be redirected to the authentication success page, and if it is unsuccessful, you will be redirected to the login page.
|
|
17
|
-
// if (isAuthenticated)
|
|
18
|
-
// Authentication.successRedirect(res);
|
|
19
|
-
// else
|
|
20
|
-
// Authentication.failureRedirect(res);
|
|
21
10
|
});
|
|
22
11
|
|
|
23
|
-
|
|
24
|
-
* Logout.
|
|
25
|
-
*/
|
|
12
|
+
// Logout.
|
|
26
13
|
router.get('/logout', (req, res) => {
|
|
27
14
|
Authentication.logout(req);
|
|
28
15
|
res.redirect('/');
|
|
29
16
|
});
|
|
30
17
|
|
|
31
|
-
|
|
32
|
-
* List Users.
|
|
33
|
-
*/
|
|
18
|
+
// Get a list of users.
|
|
34
19
|
router.get('/', async (req, res) => {
|
|
35
20
|
const data = await UserModel.paginate({
|
|
36
21
|
offset: req.query.offset,
|
|
@@ -43,9 +28,7 @@ router.get('/', async (req, res) => {
|
|
|
43
28
|
res.json(data);
|
|
44
29
|
});
|
|
45
30
|
|
|
46
|
-
|
|
47
|
-
* Create a User.
|
|
48
|
-
*/
|
|
31
|
+
// Create User.
|
|
49
32
|
router.post('/', async (req, res) => {
|
|
50
33
|
// Email duplication check.
|
|
51
34
|
const emailExists = (await UserModel.count({
|
|
@@ -69,9 +52,7 @@ router.post('/', async (req, res) => {
|
|
|
69
52
|
res.json({id: result.id});
|
|
70
53
|
});
|
|
71
54
|
|
|
72
|
-
|
|
73
|
-
* Update a User.
|
|
74
|
-
*/
|
|
55
|
+
// Update User.
|
|
75
56
|
router.put('/:id(\\d+)', async (req, res) => {
|
|
76
57
|
// Email duplication check.
|
|
77
58
|
const emailExists = (await UserModel.count({
|
|
@@ -107,16 +88,9 @@ router.put('/:id(\\d+)', async (req, res) => {
|
|
|
107
88
|
res.json(true);
|
|
108
89
|
});
|
|
109
90
|
|
|
110
|
-
|
|
111
|
-
* Delete a User.
|
|
112
|
-
*/
|
|
91
|
+
// Delete user.
|
|
113
92
|
router.delete('/:id(\\d+)', async (req, res) => {
|
|
114
|
-
|
|
115
|
-
await UserModel.destroy({
|
|
116
|
-
where: {
|
|
117
|
-
id: req.params.id
|
|
118
|
-
}
|
|
119
|
-
});
|
|
93
|
+
await UserModel.destroy({where: {id: req.params.id}});
|
|
120
94
|
res.json(true);
|
|
121
95
|
});
|
|
122
96
|
|
|
@@ -2,9 +2,7 @@ const express = require('express');
|
|
|
2
2
|
const router = express.Router();
|
|
3
3
|
const UserModel = require('../models/UserModel');
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
* User edit page.
|
|
7
|
-
*/
|
|
5
|
+
// Edit User.
|
|
8
6
|
router.get('/:id(\\d+)', async (req, res) => {
|
|
9
7
|
// Find a user that matches your ID.
|
|
10
8
|
const user = await UserModel.findByPk(req.params.id, {
|
|
@@ -20,16 +18,12 @@ router.get('/:id(\\d+)', async (req, res) => {
|
|
|
20
18
|
res.render('user', {user, edit: true});
|
|
21
19
|
});
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
* User addition page.
|
|
25
|
-
*/
|
|
21
|
+
// Create User.
|
|
26
22
|
router.get('/new', async (req, res) => {
|
|
27
23
|
res.render('user', {edit: false});
|
|
28
24
|
});
|
|
29
25
|
|
|
30
|
-
|
|
31
|
-
* Users page.
|
|
32
|
-
*/
|
|
26
|
+
// User List.
|
|
33
27
|
router.get('/', async (req, res) => {
|
|
34
28
|
res.render('users');
|
|
35
29
|
});
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
{{!< default}}
|
|
2
2
|
{{#contentFor 'title'}}Home{{/contentFor}}
|
|
3
|
-
{{#contentFor 'style'}}
|
|
4
|
-
|
|
5
|
-
<!-- <link rel="stylesheet" type="text/css" href="{{baseUrl}}/assets/styles/home.css"> -->
|
|
6
|
-
{{/contentFor}}
|
|
7
|
-
{{#contentFor 'script'}}
|
|
8
|
-
<script src="{{cache_busting '/assets/scripts/home.js' baseUrl}}"></script>
|
|
9
|
-
<!-- <script src="{{baseUrl}}/assets/scripts/home.js"></script> -->
|
|
10
|
-
{{/contentFor}}
|
|
3
|
+
{{#contentFor 'style'}}<link rel="stylesheet" type="text/css" href="{{cache_busting '/assets/home.css' baseUrl}}">{{/contentFor}}
|
|
4
|
+
{{#contentFor 'script'}}<script src="{{cache_busting '/assets/home.js' baseUrl}}"></script>{{/contentFor}}
|
|
11
5
|
<h1 class="mt-5 text-center">Welcome to Express Sweet</h1>
|
|
@@ -3,27 +3,25 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
-
<title>{{{block "title"}}} |
|
|
7
|
-
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.
|
|
8
|
-
<link rel="stylesheet" type="text/css" href="
|
|
9
|
-
<!-- <link rel="stylesheet" type="text/css" href="{{baseUrl}}/assets/styles/docs.css"> -->
|
|
6
|
+
<title>{{{block "title"}}} | Exspress Sweet Template</title>
|
|
7
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
|
|
8
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.24/css/dataTables.bootstrap5.min.css">
|
|
10
9
|
{{{block "style"}}}
|
|
11
10
|
</head>
|
|
12
11
|
<body>
|
|
13
12
|
{{#if session}}
|
|
14
|
-
<header class="navbar navbar-expand-md navbar-
|
|
15
|
-
<!-- <header class="navbar navbar-expand-md navbar-light bg-light"> -->
|
|
13
|
+
<header class="navbar navbar-expand-md navbar-light">
|
|
16
14
|
<nav class="container-xxl flex-wrap flex-md-nowrap" aria-label="Main navigation">
|
|
17
|
-
<a class="navbar-brand p-0 me-2" href="
|
|
18
|
-
<img src="{{baseUrl}}/assets/
|
|
15
|
+
<a class="navbar-brand p-0 me-2" href="/">
|
|
16
|
+
<img src="{{baseUrl}}/assets/logo.svg" height="32">
|
|
19
17
|
</a>
|
|
20
18
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#bdNavbar" aria-controls="bdNavbar" aria-expanded="false" aria-label="Toggle navigation">
|
|
21
19
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" class="bi" fill="currentColor" viewBox="0 0 16 16">
|
|
22
|
-
<path fill-rule="evenodd" d="M2.5 11.5A.5.5 0 0 1 3 11h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4A.5.5 0 0 1 3 3h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5z"
|
|
20
|
+
<path fill-rule="evenodd" d="M2.5 11.5A.5.5 0 0 1 3 11h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4A.5.5 0 0 1 3 3h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5z"></path>
|
|
23
21
|
</svg>
|
|
24
22
|
</button>
|
|
25
23
|
<div class="collapse navbar-collapse" id="bdNavbar">
|
|
26
|
-
<ul class="navbar-nav flex-row flex-wrap
|
|
24
|
+
<ul class="navbar-nav flex-row flex-wrap pt-2 py-md-0">
|
|
27
25
|
<li class="nav-item col-6 col-md-auto">
|
|
28
26
|
<a class="nav-link p-2 {{#if (eq currentPath '/')}}active{{/if}}" href="{{baseUrl}}">Home</a>
|
|
29
27
|
</li>
|
|
@@ -31,7 +29,7 @@
|
|
|
31
29
|
<a class="nav-link p-2 {{#if (eq currentPath '/users')}}active{{/if}}" href="{{baseUrl}}/users">Users</a>
|
|
32
30
|
</li>
|
|
33
31
|
</ul>
|
|
34
|
-
<a class="
|
|
32
|
+
<a class="my-md-0 ms-md-auto" href="{{baseUrl}}/api/users/logout">Logout</a>
|
|
35
33
|
</div>
|
|
36
34
|
</nav>
|
|
37
35
|
</header>
|
|
@@ -41,22 +39,19 @@
|
|
|
41
39
|
{{else}}
|
|
42
40
|
{{{body}}}
|
|
43
41
|
{{/if}}
|
|
44
|
-
|
|
45
42
|
<script>
|
|
46
43
|
// Application base URL.
|
|
47
44
|
globalThis.baseUrl = '{{baseUrl}}';
|
|
48
|
-
|
|
49
45
|
// User session.
|
|
50
46
|
{{#if session}}
|
|
51
47
|
globalThis.$$session = {{{json_stringify session}}};
|
|
52
48
|
{{/if}}
|
|
53
49
|
</script>
|
|
54
|
-
|
|
55
50
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
|
56
|
-
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.
|
|
57
|
-
<script src="
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
|
|
52
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.2/jquery.validate.min.js" integrity="sha512-UdIMMlVx0HEynClOIFSyOrPggomfhBKJE28LKl8yR3ghkgugPnG6iLfRfHwushZl1MOPSY6TsuBDGPK2X4zYKg==" crossorigin="anonymous"></script>
|
|
53
|
+
<script src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script>
|
|
54
|
+
<script src="https://cdn.datatables.net/1.10.24/js/dataTables.bootstrap5.min.js"></script>
|
|
60
55
|
{{{block "script"}}}
|
|
61
56
|
</body>
|
|
62
57
|
</html>
|
|
@@ -1,23 +1,12 @@
|
|
|
1
1
|
{{!< default}}
|
|
2
2
|
{{#contentFor 'title'}}Login{{/contentFor}}
|
|
3
|
-
{{#contentFor 'style'}}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
{{/contentFor}}
|
|
7
|
-
{{#contentFor 'script'}}
|
|
8
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.2/jquery.validate.min.js" integrity="sha512-UdIMMlVx0HEynClOIFSyOrPggomfhBKJE28LKl8yR3ghkgugPnG6iLfRfHwushZl1MOPSY6TsuBDGPK2X4zYKg==" crossorigin="anonymous"></script>
|
|
9
|
-
<script src="{{cache_busting '/assets/scripts/login.js' baseUrl}}"></script>
|
|
10
|
-
<!-- <script src="{{baseUrl}}/assets/scripts/login.js"></script> -->
|
|
11
|
-
{{/contentFor}}
|
|
12
|
-
<form id="form" class="w-100 mx-auto my-0 login-form needs-validation">
|
|
13
|
-
<!-- <form method="post" action="/api/users/login" class="w-100 mx-auto my-0 login-form needs-validation"> -->
|
|
14
|
-
<div class="text-center">
|
|
15
|
-
<img class="mb-4" src="{{baseUrl}}/assets/images/logo.svg" height="100">
|
|
16
|
-
</div>
|
|
3
|
+
{{#contentFor 'style'}}<link rel="stylesheet" type="text/css" href="{{cache_busting '/assets/login.css' baseUrl}}">{{/contentFor}}
|
|
4
|
+
{{#contentFor 'script'}}<script src="{{cache_busting '/assets/login.js' baseUrl}}"></script>{{/contentFor}}
|
|
5
|
+
<form id="form" class="w-100 mx-auto my-0 login-form">
|
|
17
6
|
<h1 class="h3 mb-3 font-weight-normal text-center">Please login</h1>
|
|
18
7
|
<div class="mb-3">
|
|
19
8
|
<label class="form-label">Email address</label>
|
|
20
|
-
<input type="email" class="form-control" name="email" required autofocus value="robin@example.com"
|
|
9
|
+
<input type="email" class="form-control" name="email" required autofocus value="robin@example.com">
|
|
21
10
|
</div>
|
|
22
11
|
<div class="mb-3">
|
|
23
12
|
<label class="form-label">Password</label>
|
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
{{!< default}}
|
|
2
|
-
{{#contentFor 'title'}}
|
|
3
|
-
{{#contentFor 'style'}}
|
|
4
|
-
|
|
5
|
-
<!-- <link rel="stylesheet" type="text/css" href="{{baseUrl}}/assets/styles/user.css"> -->
|
|
6
|
-
{{/contentFor}}
|
|
7
|
-
{{#contentFor 'script'}}
|
|
8
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.2/jquery.validate.min.js" integrity="sha512-UdIMMlVx0HEynClOIFSyOrPggomfhBKJE28LKl8yR3ghkgugPnG6iLfRfHwushZl1MOPSY6TsuBDGPK2X4zYKg==" crossorigin="anonymous"></script>
|
|
9
|
-
<script src="{{cache_busting '/assets/scripts/user.js' baseUrl}}"></script>
|
|
10
|
-
<!-- <script src="{{baseUrl}}/assets/scripts/user.js"></script> -->
|
|
11
|
-
{{/contentFor}}
|
|
2
|
+
{{#contentFor 'title'}}User Information{{/contentFor}}
|
|
3
|
+
{{#contentFor 'style'}}<link rel="stylesheet" type="text/css" href="{{cache_busting '/assets/user.css' baseUrl}}">{{/contentFor}}
|
|
4
|
+
{{#contentFor 'script'}}<script src="{{cache_busting '/assets/user.js' baseUrl}}"></script>{{/contentFor}}
|
|
12
5
|
<div class="row justify-content-center">
|
|
13
6
|
<div class="col-12 col-md-7">
|
|
14
|
-
<h3 class="font-weight-bold
|
|
15
|
-
{{ifx edit 'Edit user
|
|
7
|
+
<h3 class="font-weight-bold">
|
|
8
|
+
{{ifx edit 'Edit a user' 'Create a new user'}}
|
|
16
9
|
</h3>
|
|
17
10
|
<form id="form">
|
|
18
11
|
<div class="mb-3">
|
|
19
|
-
<label class="form-label">Email
|
|
20
|
-
<input type="email" class="form-control" name="email" value="{{user.email}}" required autofocus
|
|
12
|
+
<label class="form-label">Email</label>
|
|
13
|
+
<input type="email" class="form-control" name="email" value="{{user.email}}" required autofocus>
|
|
21
14
|
</div>
|
|
22
15
|
<div class="mb-3">
|
|
23
16
|
<label class="form-label">Name</label>
|
|
@@ -31,8 +24,8 @@
|
|
|
31
24
|
{{/if}}
|
|
32
25
|
</div>
|
|
33
26
|
<div class="d-flex justify-content-between mt-3">
|
|
34
|
-
<a href="{{baseUrl}}/users" class="btn btn-secondary">
|
|
35
|
-
<button type="submit" class="btn btn-primary">Save user
|
|
27
|
+
<a href="{{baseUrl}}/users" class="btn btn-secondary">Back to User List</a>
|
|
28
|
+
<button type="submit" class="btn btn-primary">Save user information</button>
|
|
36
29
|
</div>
|
|
37
30
|
</form>
|
|
38
31
|
</div>
|
|
@@ -1,26 +1,14 @@
|
|
|
1
1
|
{{!< default}}
|
|
2
|
-
{{#contentFor 'title'}}
|
|
3
|
-
{{#contentFor 'style'}}
|
|
4
|
-
|
|
5
|
-
<link rel="stylesheet" type="text/css" href="{{cache_busting '/assets/styles/users.css' baseUrl}}">
|
|
6
|
-
<!-- <link rel="stylesheet" type="text/css" href="{{baseUrl}}/assets/styles/users.css"> -->
|
|
7
|
-
{{/contentFor}}
|
|
8
|
-
{{#contentFor 'script'}}
|
|
9
|
-
<script src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script>
|
|
10
|
-
<script src="https://cdn.datatables.net/1.10.24/js/dataTables.bootstrap5.min.js"></script>
|
|
11
|
-
<script src="{{cache_busting '/assets/scripts/users.js' baseUrl}}"></script>
|
|
12
|
-
<!-- <script src="{{baseUrl}}/assets/scripts/users.js"></script> -->
|
|
13
|
-
{{/contentFor}}
|
|
14
|
-
|
|
2
|
+
{{#contentFor 'title'}}User Management{{/contentFor}}
|
|
3
|
+
{{#contentFor 'style'}}<link rel="stylesheet" type="text/css" href="{{cache_busting '/assets/users.css' baseUrl}}">{{/contentFor}}
|
|
4
|
+
{{#contentFor 'script'}}<script src="{{cache_busting '/assets/users.js' baseUrl}}"></script>{{/contentFor}}
|
|
15
5
|
<div class="d-flex mb-4">
|
|
16
|
-
<
|
|
17
|
-
<a href="/users/new" class="btn btn-primary" style="margin-left: auto;">Add New</a>
|
|
6
|
+
<a href="/users/new" class="btn btn-primary ms-auto">Create new user</a>
|
|
18
7
|
</div>
|
|
19
|
-
|
|
20
8
|
<table class="table w-100" id="table">
|
|
21
9
|
<thead>
|
|
22
10
|
<tr>
|
|
23
|
-
<th scope="col">ID</th>
|
|
11
|
+
<th scope="col">User ID</th>
|
|
24
12
|
<th scope="col">Email</th>
|
|
25
13
|
<th scope="col">Name</th>
|
|
26
14
|
<th scope="col">Modified</th>
|
|
@@ -10,6 +10,21 @@ export default {
|
|
|
10
10
|
*/
|
|
11
11
|
enabled: true,
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* The session store instance, defaults to a new MemoryStore(memory) instance.
|
|
15
|
+
* @type {'memory|redis'}
|
|
16
|
+
*/
|
|
17
|
+
session_store: 'memory',
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* If the session is stored in "redis", this field is required and should be set to the hostname of the Redis server.
|
|
21
|
+
* For example, to connect to redis on localhost on port 6379, set "redis://localhost:6379".
|
|
22
|
+
* To connect to a different host or port, use a connection string in the format "redis[s]://[[username][:password]@][host][:port][/db-number]".
|
|
23
|
+
* For example, "redis://alice:foobared@awesome.redis.server:6380".
|
|
24
|
+
* @type {string|undefined}
|
|
25
|
+
*/
|
|
26
|
+
redis_host: undefined,
|
|
27
|
+
|
|
13
28
|
/**
|
|
14
29
|
* Authentication user ID field name, defaults to `username`.
|
|
15
30
|
* @type {string}
|
|
@@ -4,38 +4,32 @@
|
|
|
4
4
|
export default {
|
|
5
5
|
development: {
|
|
6
6
|
username: 'root',
|
|
7
|
-
password:
|
|
8
|
-
database: '
|
|
7
|
+
password: 'password',
|
|
8
|
+
database: 'mydb',
|
|
9
9
|
host: 'localhost',
|
|
10
10
|
port: undefined,
|
|
11
11
|
dialect: 'mariadb',
|
|
12
12
|
timezone: '+09:00',
|
|
13
13
|
logging: false
|
|
14
|
-
//,timezone: 'Etc/GMT-9'
|
|
15
|
-
//,dialectOptions: {useUTC: false, timezone: 'Etc/GMT-9'}
|
|
16
14
|
},
|
|
17
15
|
test: {
|
|
18
16
|
username: 'root',
|
|
19
|
-
password:
|
|
20
|
-
database: '
|
|
17
|
+
password: 'password',
|
|
18
|
+
database: 'mydb',
|
|
21
19
|
host: 'localhost',
|
|
22
20
|
port: undefined,
|
|
23
21
|
dialect: 'mariadb',
|
|
24
22
|
timezone: '+09:00',
|
|
25
23
|
logging: false
|
|
26
|
-
//,timezone: 'Etc/GMT-9'
|
|
27
|
-
//,dialectOptions: {useUTC: false, timezone: 'Etc/GMT-9'}
|
|
28
24
|
},
|
|
29
25
|
production: {
|
|
30
26
|
username: 'root',
|
|
31
|
-
password:
|
|
32
|
-
database: '
|
|
27
|
+
password: 'password',
|
|
28
|
+
database: 'mydb',
|
|
33
29
|
host: 'localhost',
|
|
34
30
|
port: undefined,
|
|
35
31
|
dialect: 'mariadb',
|
|
36
32
|
timezone: '+09:00',
|
|
37
33
|
logging: false
|
|
38
|
-
//,timezone: 'Etc/GMT-9'
|
|
39
|
-
//,dialectOptions: {useUTC: false, timezone: 'Etc/GMT-9'}
|
|
40
34
|
}
|
|
41
35
|
}
|
|
@@ -32,5 +32,19 @@ export default {
|
|
|
32
32
|
* Extension for templates & partials, defaults to `.hbs`,
|
|
33
33
|
* @type {string}
|
|
34
34
|
*/
|
|
35
|
-
extension: '.hbs'
|
|
35
|
+
extension: '.hbs',
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Hook function just before the view is rendered.
|
|
39
|
+
* For example, you can set your own local variables that can be used within the view.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* // The message set here can be referenced in the view as {{message}}.
|
|
43
|
+
* beforeRender: res => {
|
|
44
|
+
* res.loclas.message = 'Hello World';
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
* @type {(res: express.Response) => void}
|
|
48
|
+
*/
|
|
49
|
+
beforeRender: (res) => {}
|
|
36
50
|
}
|
|
@@ -9,7 +9,11 @@ module.exports = {
|
|
|
9
9
|
exec_mode: 'cluster_mode',
|
|
10
10
|
watch: '.',
|
|
11
11
|
watch_delay: 3000,
|
|
12
|
-
ignore_watch : [
|
|
12
|
+
ignore_watch : [
|
|
13
|
+
'node_modules',
|
|
14
|
+
'public',
|
|
15
|
+
'views'
|
|
16
|
+
],
|
|
13
17
|
watch_options: {
|
|
14
18
|
followSymlinks: false,
|
|
15
19
|
usePolling: true
|
|
File without changes
|
|
File without changes
|