express-generator-typescript 2.4.25 → 2.5.1
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/README.md +24 -33
- package/lib/cli.js +5 -25
- package/lib/express-generator-typescript.js +11 -19
- package/lib/project-files/README.md +18 -1
- package/lib/{project-files-auth/env/development.env → project-files/config/.env.development} +0 -9
- package/lib/project-files/config/.env.production +14 -0
- package/lib/project-files/{env/test.env → config/.env.test} +0 -10
- package/lib/project-files/config.js +18 -0
- package/lib/project-files/config.ts +22 -0
- package/lib/project-files/eslint.config.ts +96 -0
- package/lib/project-files/gitignore +2 -0
- package/lib/project-files/package.json +16 -9
- package/lib/project-files/scripts/build.ts +4 -0
- package/lib/project-files/spec/support/Paths.ts +1 -6
- package/lib/project-files/spec/support/apiCb.ts +18 -6
- package/lib/project-files/spec/tests/users.spec.ts +28 -33
- package/lib/project-files/spec/types/misc.ts +7 -6
- package/lib/project-files/spec/types/supertest/index.d.ts +2 -2
- package/lib/project-files/src/common/Env.ts +10 -0
- package/lib/project-files/src/common/route-errors.ts +41 -0
- package/lib/project-files/src/index.ts +3 -3
- package/lib/project-files/src/models/User.ts +9 -57
- package/lib/project-files/src/repos/MockOrm.ts +0 -2
- package/lib/project-files/src/repos/database.json +1 -1
- package/lib/project-files/src/routes/UserRoutes.ts +14 -5
- package/lib/project-files/src/{common → routes/common}/Paths.ts +0 -4
- package/lib/project-files/src/routes/common/index.ts +37 -0
- package/lib/project-files/src/routes/index.ts +1 -1
- package/lib/project-files/src/server.ts +7 -9
- package/lib/project-files/src/services/UserService.ts +1 -1
- package/lib/project-files/src/util/misc.ts +0 -16
- package/lib/project-files/src/util/schema.ts +11 -0
- package/lib/project-files/src/util/validators.ts +322 -0
- package/lib/project-files/tsconfig.json +20 -71
- package/lib/project-files/tsconfig.prod.json +22 -2
- package/package.json +1 -1
- package/lib/project-files/env/development.env +0 -24
- package/lib/project-files/env/production.env +0 -25
- package/lib/project-files/eslint.config.mjs +0 -58
- package/lib/project-files/preload.js +0 -23
- package/lib/project-files/src/common/EnvVars.ts +0 -24
- package/lib/project-files/src/common/classes.ts +0 -32
- package/lib/project-files/src/common/misc.ts +0 -5
- package/lib/project-files/src/routes/common/check.ts +0 -143
- package/lib/project-files/src/routes/common/types.ts +0 -8
- package/lib/project-files-auth/README.md +0 -35
- package/lib/project-files-auth/env/production.env +0 -25
- package/lib/project-files-auth/env/test.env +0 -24
- package/lib/project-files-auth/eslint.config.mjs +0 -58
- package/lib/project-files-auth/gitignore +0 -3
- package/lib/project-files-auth/package.json +0 -60
- package/lib/project-files-auth/preload.js +0 -23
- package/lib/project-files-auth/scripts/build.ts +0 -62
- package/lib/project-files-auth/spec/index.ts +0 -46
- package/lib/project-files-auth/spec/support/Paths.ts +0 -10
- package/lib/project-files-auth/spec/support/apiCb.ts +0 -76
- package/lib/project-files-auth/spec/support/jasmine.json +0 -11
- package/lib/project-files-auth/spec/support/login.ts +0 -42
- package/lib/project-files-auth/spec/tests/auth.spec.ts +0 -115
- package/lib/project-files-auth/spec/tests/users.spec.ts +0 -190
- package/lib/project-files-auth/spec/types/misc.ts +0 -12
- package/lib/project-files-auth/spec/types/supertest/index.d.ts +0 -14
- package/lib/project-files-auth/src/common/EnvVars.ts +0 -24
- package/lib/project-files-auth/src/common/HttpStatusCodes.ts +0 -386
- package/lib/project-files-auth/src/common/Paths.ts +0 -20
- package/lib/project-files-auth/src/common/classes.ts +0 -31
- package/lib/project-files-auth/src/index.ts +0 -12
- package/lib/project-files-auth/src/models/User.ts +0 -89
- package/lib/project-files-auth/src/public/scripts/http.js +0 -26
- package/lib/project-files-auth/src/public/scripts/login.js +0 -15
- package/lib/project-files-auth/src/public/scripts/users.js +0 -138
- package/lib/project-files-auth/src/public/stylesheets/login.css +0 -24
- package/lib/project-files-auth/src/public/stylesheets/users.css +0 -43
- package/lib/project-files-auth/src/repos/MockOrm.ts +0 -42
- package/lib/project-files-auth/src/repos/UserRepo.ts +0 -93
- package/lib/project-files-auth/src/repos/database.json +0 -1
- package/lib/project-files-auth/src/routes/AuthRoutes.ts +0 -42
- package/lib/project-files-auth/src/routes/UserRoutes.ts +0 -55
- package/lib/project-files-auth/src/routes/common/check.ts +0 -143
- package/lib/project-files-auth/src/routes/common/types.ts +0 -22
- package/lib/project-files-auth/src/routes/index.ts +0 -43
- package/lib/project-files-auth/src/routes/middleware/adminMw.ts +0 -47
- package/lib/project-files-auth/src/server.ts +0 -91
- package/lib/project-files-auth/src/services/AuthService.ts +0 -57
- package/lib/project-files-auth/src/services/UserService.ts +0 -59
- package/lib/project-files-auth/src/util/PwdUtil.ts +0 -39
- package/lib/project-files-auth/src/util/SessionUtil.ts +0 -94
- package/lib/project-files-auth/src/util/misc.ts +0 -22
- package/lib/project-files-auth/src/views/login.html +0 -58
- package/lib/project-files-auth/src/views/users.html +0 -140
- package/lib/project-files-auth/tsconfig.json +0 -87
- package/lib/project-files-auth/tsconfig.prod.json +0 -12
- /package/lib/{project-files-auth/src/common/misc.ts → project-files/src/common/constants.ts} +0 -0
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Setup express server.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import cookieParser from 'cookie-parser';
|
|
6
|
-
import morgan from 'morgan';
|
|
7
|
-
import path from 'path';
|
|
8
|
-
import helmet from 'helmet';
|
|
9
|
-
import express, { Request, Response, NextFunction } from 'express';
|
|
10
|
-
import logger from 'jet-logger';
|
|
11
|
-
|
|
12
|
-
import 'express-async-errors';
|
|
13
|
-
|
|
14
|
-
import BaseRouter from '@src/routes';
|
|
15
|
-
|
|
16
|
-
import Paths from '@src/common/Paths';
|
|
17
|
-
import EnvVars from '@src/common/EnvVars';
|
|
18
|
-
import HttpStatusCodes from '@src/common/HttpStatusCodes';
|
|
19
|
-
import { NodeEnvs } from '@src/common/misc';
|
|
20
|
-
import { RouteError } from '@src/common/classes';
|
|
21
|
-
import { IReq, IRes } from './routes/common/types';
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// **** Variables **** //
|
|
25
|
-
|
|
26
|
-
const app = express();
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// **** Setup **** //
|
|
30
|
-
|
|
31
|
-
// Basic middleware
|
|
32
|
-
app.use(express.json());
|
|
33
|
-
app.use(express.urlencoded({extended: true}));
|
|
34
|
-
app.use(cookieParser(EnvVars.CookieProps.Secret));
|
|
35
|
-
|
|
36
|
-
// Show routes called in console during development
|
|
37
|
-
if (EnvVars.NodeEnv === NodeEnvs.Dev.valueOf()) {
|
|
38
|
-
app.use(morgan('dev'));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Security
|
|
42
|
-
if (EnvVars.NodeEnv === NodeEnvs.Production.valueOf()) {
|
|
43
|
-
app.use(helmet());
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Add APIs, must be after middleware
|
|
47
|
-
app.use(Paths.Base, BaseRouter);
|
|
48
|
-
|
|
49
|
-
// Add error handler
|
|
50
|
-
app.use((err: Error, _: Request, res: Response, next: NextFunction) => {
|
|
51
|
-
if (EnvVars.NodeEnv !== NodeEnvs.Test.valueOf()) {
|
|
52
|
-
logger.err(err, true);
|
|
53
|
-
}
|
|
54
|
-
let status = HttpStatusCodes.BAD_REQUEST;
|
|
55
|
-
if (err instanceof RouteError) {
|
|
56
|
-
status = err.status;
|
|
57
|
-
res.status(status).json({ error: err.message });
|
|
58
|
-
}
|
|
59
|
-
return next(err);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
// ** Front-End Content ** //
|
|
64
|
-
|
|
65
|
-
// Set views directory (html)
|
|
66
|
-
const viewsDir = path.join(__dirname, 'views');
|
|
67
|
-
app.set('views', viewsDir);
|
|
68
|
-
|
|
69
|
-
// Set static directory (js and css).
|
|
70
|
-
const staticDir = path.join(__dirname, 'public');
|
|
71
|
-
app.use(express.static(staticDir));
|
|
72
|
-
|
|
73
|
-
// Nav to login pg by default
|
|
74
|
-
app.get('/', (_: Request, res: Response) => {
|
|
75
|
-
res.sendFile('login.html', { root: viewsDir });
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
// Redirect to login if not logged in.
|
|
79
|
-
app.get('/users', (req: IReq, res: IRes) => {
|
|
80
|
-
const jwt = req.signedCookies[EnvVars.CookieProps.Key];
|
|
81
|
-
if (!jwt) {
|
|
82
|
-
res.redirect('/');
|
|
83
|
-
} else {
|
|
84
|
-
res.sendFile('users.html', {root: viewsDir});
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
// **** Export default **** //
|
|
90
|
-
|
|
91
|
-
export default app;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import UserRepo from '@src/repos/UserRepo';
|
|
2
|
-
|
|
3
|
-
import PwdUtil from '@src/util/PwdUtil';
|
|
4
|
-
import { tick } from '@src/util/misc';
|
|
5
|
-
|
|
6
|
-
import HttpStatusCodes from '@src/common/HttpStatusCodes';
|
|
7
|
-
import { RouteError } from '@src/common/classes';
|
|
8
|
-
|
|
9
|
-
import { IUser } from '@src/models/User';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// **** Variables **** //
|
|
13
|
-
|
|
14
|
-
// Errors
|
|
15
|
-
export const Errors = {
|
|
16
|
-
Unauth: 'Unauthorized',
|
|
17
|
-
EmailNotFound(email: string) {
|
|
18
|
-
return `User with email "${email}" not found`;
|
|
19
|
-
},
|
|
20
|
-
} as const;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// **** Functions **** //
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Login a user.
|
|
27
|
-
*/
|
|
28
|
-
async function login(email: string, password: string): Promise<IUser> {
|
|
29
|
-
// Fetch user
|
|
30
|
-
const user = await UserRepo.getOne(email);
|
|
31
|
-
if (!user) {
|
|
32
|
-
throw new RouteError(
|
|
33
|
-
HttpStatusCodes.UNAUTHORIZED,
|
|
34
|
-
Errors.EmailNotFound(email),
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
// Check password
|
|
38
|
-
const hash = (user.pwdHash ?? ''),
|
|
39
|
-
pwdPassed = await PwdUtil.compare(password, hash);
|
|
40
|
-
if (!pwdPassed) {
|
|
41
|
-
// If password failed, wait 500ms this will increase security
|
|
42
|
-
await tick(500);
|
|
43
|
-
throw new RouteError(
|
|
44
|
-
HttpStatusCodes.UNAUTHORIZED,
|
|
45
|
-
Errors.Unauth,
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
// Return
|
|
49
|
-
return user;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// **** Export default **** //
|
|
54
|
-
|
|
55
|
-
export default {
|
|
56
|
-
login,
|
|
57
|
-
} as const;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { RouteError } from '@src/common/classes';
|
|
2
|
-
import HttpStatusCodes from '@src/common/HttpStatusCodes';
|
|
3
|
-
|
|
4
|
-
import UserRepo from '@src/repos/UserRepo';
|
|
5
|
-
import { IUser } from '@src/models/User';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// **** Variables **** //
|
|
9
|
-
|
|
10
|
-
export const USER_NOT_FOUND_ERR = 'User not found';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// **** Functions **** //
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Get all users.
|
|
17
|
-
*/
|
|
18
|
-
function getAll(): Promise<IUser[]> {
|
|
19
|
-
return UserRepo.getAll();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Add one user.
|
|
24
|
-
*/
|
|
25
|
-
function addOne(user: IUser): Promise<void> {
|
|
26
|
-
return UserRepo.add(user);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Update one user.
|
|
31
|
-
*/
|
|
32
|
-
async function updateOne(user: IUser): Promise<void> {
|
|
33
|
-
const persists = await UserRepo.persists(user.id);
|
|
34
|
-
if (!persists) {
|
|
35
|
-
throw new RouteError(HttpStatusCodes.NOT_FOUND, USER_NOT_FOUND_ERR);
|
|
36
|
-
}
|
|
37
|
-
return UserRepo.update(user);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Delete a user by their id.
|
|
42
|
-
*/
|
|
43
|
-
async function _delete(id: number): Promise<void> {
|
|
44
|
-
const persists = await UserRepo.persists(id);
|
|
45
|
-
if (!persists) {
|
|
46
|
-
throw new RouteError(HttpStatusCodes.NOT_FOUND, USER_NOT_FOUND_ERR);
|
|
47
|
-
}
|
|
48
|
-
return UserRepo.delete(id);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
// **** Export default **** //
|
|
53
|
-
|
|
54
|
-
export default {
|
|
55
|
-
getAll,
|
|
56
|
-
addOne,
|
|
57
|
-
updateOne,
|
|
58
|
-
delete: _delete,
|
|
59
|
-
} as const;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import bcrypt from 'bcrypt';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// **** Variables **** //
|
|
5
|
-
|
|
6
|
-
const SALT_ROUNDS = 12;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// **** Functions **** //
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Get a hash from the password.
|
|
13
|
-
*/
|
|
14
|
-
function getHash(pwd: string): Promise<string> {
|
|
15
|
-
return bcrypt.hash(pwd, SALT_ROUNDS);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Useful for testing.
|
|
20
|
-
*/
|
|
21
|
-
function hashSync(pwd: string): string {
|
|
22
|
-
return bcrypt.hashSync(pwd, SALT_ROUNDS);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* See if a password passes the hash.
|
|
27
|
-
*/
|
|
28
|
-
function compare(pwd: string, hash: string): Promise<boolean> {
|
|
29
|
-
return bcrypt.compare(pwd, hash);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// **** Export Default **** //
|
|
34
|
-
|
|
35
|
-
export default {
|
|
36
|
-
getHash,
|
|
37
|
-
hashSync,
|
|
38
|
-
compare,
|
|
39
|
-
} as const;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import jsonwebtoken from 'jsonwebtoken';
|
|
2
|
-
|
|
3
|
-
import HttpStatusCodes from '@src/common/HttpStatusCodes';
|
|
4
|
-
import { RouteError } from '@src/common/classes';
|
|
5
|
-
import EnvVars from '@src/common/EnvVars';
|
|
6
|
-
import { IReq, IRes } from '@src/routes/common/types';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// **** Variables **** //
|
|
10
|
-
|
|
11
|
-
// Errors
|
|
12
|
-
const Errors = {
|
|
13
|
-
ParamFalsey: 'Param is falsey',
|
|
14
|
-
Validation: 'JSON-web-token validation failed.',
|
|
15
|
-
} as const;
|
|
16
|
-
|
|
17
|
-
// Options
|
|
18
|
-
const Options = {
|
|
19
|
-
expiresIn: EnvVars.Jwt.Exp,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// **** Functions **** //
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Get session data from request object (i.e. ISessionUser)
|
|
27
|
-
*/
|
|
28
|
-
function getSessionData<T>(req: IReq): Promise<string | T | undefined> {
|
|
29
|
-
const { Key } = EnvVars.CookieProps,
|
|
30
|
-
jwt = req.signedCookies[Key];
|
|
31
|
-
return _decode(jwt);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Decrypt JWT and extract client data.
|
|
36
|
-
*/
|
|
37
|
-
function _decode<T>(jwt: string): Promise<string | undefined | T> {
|
|
38
|
-
return new Promise((res, rej) => {
|
|
39
|
-
jsonwebtoken.verify(jwt, EnvVars.Jwt.Secret, (err, decoded) => {
|
|
40
|
-
if (!!err) {
|
|
41
|
-
const err = new RouteError(HttpStatusCodes.UNAUTHORIZED,
|
|
42
|
-
Errors.Validation);
|
|
43
|
-
return rej(err);
|
|
44
|
-
} else {
|
|
45
|
-
return res(decoded as T);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Add a JWT to the response
|
|
53
|
-
*/
|
|
54
|
-
async function addSessionData(
|
|
55
|
-
res: IRes,
|
|
56
|
-
data: string | object,
|
|
57
|
-
): Promise<IRes> {
|
|
58
|
-
if (!res || !data) {
|
|
59
|
-
throw new RouteError(HttpStatusCodes.BAD_REQUEST, Errors.ParamFalsey);
|
|
60
|
-
}
|
|
61
|
-
// Setup JWT
|
|
62
|
-
const jwt = await _sign(data),
|
|
63
|
-
{ Key, Options } = EnvVars.CookieProps;
|
|
64
|
-
// Return
|
|
65
|
-
return res.cookie(Key, jwt, Options);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Encrypt data and return jwt.
|
|
70
|
-
*/
|
|
71
|
-
function _sign(data: string | object | Buffer): Promise<string> {
|
|
72
|
-
return new Promise((res, rej) => {
|
|
73
|
-
jsonwebtoken.sign(data, EnvVars.Jwt.Secret, Options, (err, token) => {
|
|
74
|
-
return (err ? rej(err) : res(token ?? ''));
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Remove cookie
|
|
81
|
-
*/
|
|
82
|
-
function clearCookie(res: IRes): IRes {
|
|
83
|
-
const { Key, Options } = EnvVars.CookieProps;
|
|
84
|
-
return res.clearCookie(Key, Options);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
// **** Export default **** //
|
|
89
|
-
|
|
90
|
-
export default {
|
|
91
|
-
addSessionData,
|
|
92
|
-
getSessionData,
|
|
93
|
-
clearCookie,
|
|
94
|
-
} as const;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Miscellaneous shared functions go here.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Get a random number between 1 and 1,000,000,000,000
|
|
8
|
-
*/
|
|
9
|
-
export function getRandomInt(): number {
|
|
10
|
-
return Math.floor(Math.random() * 1_000_000_000_000);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Wait for a certain number of milliseconds.
|
|
15
|
-
*/
|
|
16
|
-
export function tick(milliseconds: number): Promise<void> {
|
|
17
|
-
return new Promise((resolve) => {
|
|
18
|
-
setTimeout(() => {
|
|
19
|
-
resolve();
|
|
20
|
-
}, milliseconds);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
|
|
4
|
-
<!-- Head -->
|
|
5
|
-
<head>
|
|
6
|
-
<meta charset="UTF-8">
|
|
7
|
-
<title>Login</title>
|
|
8
|
-
<link rel="stylesheet" type="text/css" href="/stylesheets/login.css" />
|
|
9
|
-
|
|
10
|
-
<!-- Handlebars -->
|
|
11
|
-
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.7.8/handlebars.min.js"></script>
|
|
12
|
-
|
|
13
|
-
<!-- Bootstrap -->
|
|
14
|
-
<link
|
|
15
|
-
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
|
|
16
|
-
rel="stylesheet"
|
|
17
|
-
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
|
|
18
|
-
crossorigin="anonymous"
|
|
19
|
-
/>
|
|
20
|
-
<script
|
|
21
|
-
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
|
|
22
|
-
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
|
|
23
|
-
crossorigin="anonymous"
|
|
24
|
-
></script>
|
|
25
|
-
</head>
|
|
26
|
-
|
|
27
|
-
<!-- Body -->
|
|
28
|
-
<body>
|
|
29
|
-
|
|
30
|
-
<div class="login-block">
|
|
31
|
-
<div class="login-header">Login</div>
|
|
32
|
-
|
|
33
|
-
<div class="login-input">
|
|
34
|
-
Username:<br/>
|
|
35
|
-
<input id="email-input" type="text" class="form-control"/>
|
|
36
|
-
</div>
|
|
37
|
-
|
|
38
|
-
<div class="login-input">
|
|
39
|
-
Password:<br/>
|
|
40
|
-
<input id="pwd-input" type="password" class="form-control"/>
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
<div>
|
|
44
|
-
<button id="login-btn" class="btn btn-primary">
|
|
45
|
-
Login
|
|
46
|
-
</button>
|
|
47
|
-
</div>
|
|
48
|
-
|
|
49
|
-
<div class="default-login-user">
|
|
50
|
-
// Default admin user (Email: "sean.maxwell@gmail.com", Password: "Password@1")
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
</body>
|
|
55
|
-
|
|
56
|
-
<script src="scripts/http.js"></script>
|
|
57
|
-
<script src="scripts/login.js"></script>
|
|
58
|
-
</html>
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
|
|
4
|
-
<!-- Head -->
|
|
5
|
-
<head>
|
|
6
|
-
<meta charset="UTF-8">
|
|
7
|
-
<title>Users</title>
|
|
8
|
-
<link rel="stylesheet" type="text/css" href="/stylesheets/users.css" />
|
|
9
|
-
|
|
10
|
-
<!-- Handlebars -->
|
|
11
|
-
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.7.8/handlebars.min.js"></script>
|
|
12
|
-
|
|
13
|
-
<!-- Bootstrap -->
|
|
14
|
-
<link
|
|
15
|
-
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
|
|
16
|
-
rel="stylesheet"
|
|
17
|
-
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
|
|
18
|
-
crossorigin="anonymous"
|
|
19
|
-
/>
|
|
20
|
-
<script
|
|
21
|
-
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
|
|
22
|
-
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
|
|
23
|
-
crossorigin="anonymous"
|
|
24
|
-
></script>
|
|
25
|
-
</head>
|
|
26
|
-
|
|
27
|
-
<!-- Body -->
|
|
28
|
-
<body>
|
|
29
|
-
|
|
30
|
-
<!-- Add Users -->
|
|
31
|
-
<div class="users-column add-user-col">
|
|
32
|
-
<div class="column-header">
|
|
33
|
-
Add User:
|
|
34
|
-
</div>
|
|
35
|
-
<div>
|
|
36
|
-
<input
|
|
37
|
-
id="name-input"
|
|
38
|
-
type="text"
|
|
39
|
-
class="form-control"
|
|
40
|
-
placeholder="Name"
|
|
41
|
-
/>
|
|
42
|
-
</div>
|
|
43
|
-
<div>
|
|
44
|
-
<input
|
|
45
|
-
id="email-input"
|
|
46
|
-
type="email"
|
|
47
|
-
class="form-control"
|
|
48
|
-
placeholder="Email"
|
|
49
|
-
/>
|
|
50
|
-
</div>
|
|
51
|
-
<div>
|
|
52
|
-
<button
|
|
53
|
-
id="add-user-btn"
|
|
54
|
-
class="btn btn-success"
|
|
55
|
-
>
|
|
56
|
-
Add
|
|
57
|
-
</button>
|
|
58
|
-
<button
|
|
59
|
-
id="logout-btn"
|
|
60
|
-
class="btn btn-secondary"
|
|
61
|
-
>
|
|
62
|
-
Logout
|
|
63
|
-
</button>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
|
|
67
|
-
<!-- Display Users -->
|
|
68
|
-
<div class="users-column">
|
|
69
|
-
<div class="column-header">
|
|
70
|
-
Users:
|
|
71
|
-
</div>
|
|
72
|
-
|
|
73
|
-
<div id="all-users-anchor"></div>
|
|
74
|
-
<script
|
|
75
|
-
id="all-users-template"
|
|
76
|
-
type="text/x-handlebars-template"
|
|
77
|
-
>
|
|
78
|
-
{{#each users}}
|
|
79
|
-
<div class="user-display-ele">
|
|
80
|
-
<div class="normal-view">
|
|
81
|
-
<div class="display-wrapper">
|
|
82
|
-
<div><b>Name:</b> {{name}}</div>
|
|
83
|
-
<div><b>Email:</b> {{email}}</div>
|
|
84
|
-
<div><b>Created:</b> {{createdFormatted}}</div>
|
|
85
|
-
</div>
|
|
86
|
-
<button
|
|
87
|
-
type="button"
|
|
88
|
-
class="btn btn-primary edit-user-btn"
|
|
89
|
-
data-user-id="{{id}}"
|
|
90
|
-
>
|
|
91
|
-
Edit
|
|
92
|
-
</button>
|
|
93
|
-
<button
|
|
94
|
-
class="btn btn-danger delete-user-btn"
|
|
95
|
-
data-user-id="{{id}}"
|
|
96
|
-
>
|
|
97
|
-
Delete
|
|
98
|
-
</button>
|
|
99
|
-
</div>
|
|
100
|
-
|
|
101
|
-
<div class="edit-view">
|
|
102
|
-
<div>
|
|
103
|
-
Name:
|
|
104
|
-
<input
|
|
105
|
-
type="text"
|
|
106
|
-
class="form-control name-edit-input"
|
|
107
|
-
value="{{name}}"
|
|
108
|
-
/>
|
|
109
|
-
</div>
|
|
110
|
-
<div class="email-edit">
|
|
111
|
-
Email:
|
|
112
|
-
<input
|
|
113
|
-
type="email"
|
|
114
|
-
class="form-control email-edit-input"
|
|
115
|
-
value="{{email}}"
|
|
116
|
-
/>
|
|
117
|
-
</div>
|
|
118
|
-
<button
|
|
119
|
-
class="btn btn-primary submit-edit-btn"
|
|
120
|
-
data-user-id="{{id}}"
|
|
121
|
-
data-user-created="{{created}}"
|
|
122
|
-
>
|
|
123
|
-
Submit
|
|
124
|
-
</button>
|
|
125
|
-
<button
|
|
126
|
-
class="btn btn-secondary cancel-edit-btn"
|
|
127
|
-
data-user-id="{{id}}"
|
|
128
|
-
>
|
|
129
|
-
Cancel
|
|
130
|
-
</button>
|
|
131
|
-
</div>
|
|
132
|
-
</div>
|
|
133
|
-
{{/each}}
|
|
134
|
-
</script>
|
|
135
|
-
</div>
|
|
136
|
-
</body>
|
|
137
|
-
|
|
138
|
-
<script src="scripts/http.js"></script>
|
|
139
|
-
<script src="scripts/users.js"></script>
|
|
140
|
-
</html>
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
-
|
|
5
|
-
/* Basic Options */
|
|
6
|
-
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
-
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
|
|
8
|
-
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
|
9
|
-
// "lib": [], /* Specify library files to be included in the compilation. */
|
|
10
|
-
// "allowJs": true, /* Allow javascript files to be compiled. */
|
|
11
|
-
// "checkJs": true, /* Report errors in .js files. */
|
|
12
|
-
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
|
13
|
-
// "declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
14
|
-
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
15
|
-
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
|
16
|
-
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
17
|
-
"outDir": "dist", /* Redirect output structure to the directory. */
|
|
18
|
-
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
19
|
-
// "composite": true, /* Enable project compilation */
|
|
20
|
-
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
21
|
-
// "removeComments": true, /* Do not emit comments to output. */
|
|
22
|
-
// "noEmit": true, /* Do not emit outputs. */
|
|
23
|
-
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
24
|
-
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
25
|
-
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
26
|
-
|
|
27
|
-
/* Strict Type-Checking Options */
|
|
28
|
-
"strict": true, /* Enable all strict type-checking options. */
|
|
29
|
-
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
30
|
-
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
31
|
-
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
32
|
-
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
|
33
|
-
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
34
|
-
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
35
|
-
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
36
|
-
|
|
37
|
-
/* Additional Checks */
|
|
38
|
-
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
39
|
-
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
40
|
-
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
41
|
-
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
42
|
-
|
|
43
|
-
/* Module Resolution Options */
|
|
44
|
-
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
45
|
-
"baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
46
|
-
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
47
|
-
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
48
|
-
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
49
|
-
// "types": [], /* Type declaration files to be included in compilation. */
|
|
50
|
-
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
51
|
-
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
52
|
-
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
53
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
54
|
-
|
|
55
|
-
/* Source Map Options */
|
|
56
|
-
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
57
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
58
|
-
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
59
|
-
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
60
|
-
|
|
61
|
-
/* Experimental Options */
|
|
62
|
-
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
63
|
-
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
64
|
-
|
|
65
|
-
/* Advanced Options */
|
|
66
|
-
"skipLibCheck": true, /* Skip type checking of declaration files. */
|
|
67
|
-
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
|
|
68
|
-
"paths": {
|
|
69
|
-
"@src/*": [
|
|
70
|
-
"src/*"
|
|
71
|
-
],
|
|
72
|
-
},
|
|
73
|
-
"useUnknownInCatchVariables": false
|
|
74
|
-
},
|
|
75
|
-
"ts-node": {
|
|
76
|
-
"require": ["tsconfig-paths/register", "./preload.js"]
|
|
77
|
-
},
|
|
78
|
-
"include": [
|
|
79
|
-
"src/**/*.ts",
|
|
80
|
-
"spec/**/*.ts",
|
|
81
|
-
"scripts",
|
|
82
|
-
"preload.js"
|
|
83
|
-
],
|
|
84
|
-
"exclude": [
|
|
85
|
-
"src/public/*"
|
|
86
|
-
]
|
|
87
|
-
}
|
/package/lib/{project-files-auth/src/common/misc.ts → project-files/src/common/constants.ts}
RENAMED
|
File without changes
|