Merge branch 'develop'
This commit is contained in:
commit
9a862bc334
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,3 +2,6 @@
|
|||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
yarn-error.log
|
yarn-error.log
|
||||||
|
|
||||||
|
src/package.json
|
||||||
|
config/local.*
|
||||||
|
11
package.json
11
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "swaf",
|
"name": "swaf",
|
||||||
"version": "0.23.0",
|
"version": "0.23.1",
|
||||||
"description": "Structure Web Application Framework.",
|
"description": "Structure Web Application Framework.",
|
||||||
"repository": "https://eternae.ink/arisu/swaf",
|
"repository": "https://eternae.ink/arisu/swaf",
|
||||||
"author": "Alice Gaudon <alice@gaudon.pro>",
|
"author": "Alice Gaudon <alice@gaudon.pro>",
|
||||||
@ -10,16 +10,17 @@
|
|||||||
"registry": "https://registry.npmjs.com",
|
"registry": "https://registry.npmjs.com",
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
"main": "dist/src/main.js",
|
"main": "dist/main.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jest --verbose --runInBand",
|
"test": "jest --verbose --runInBand",
|
||||||
"clean": "(test ! -d dist || rm -r dist)",
|
"clean": "(test ! -d dist || rm -r dist)",
|
||||||
|
"prepare": "cp package.json src/",
|
||||||
"compile": "yarn clean && tsc",
|
"compile": "yarn clean && tsc",
|
||||||
"dev": "concurrently -k -n \"Typescript,Node,Webpack,Maildev\" -p \"[{name}]\" -c \"blue,green,red,yellow\" \"tsc --watch\" \"nodemon\" \"maildev\"",
|
"dev": "yarn prepare && concurrently -k -n \"Typescript,Node,Webpack,Maildev\" -p \"[{name}]\" -c \"blue,green,red,yellow\" \"tsc --watch\" \"nodemon\" \"maildev\"",
|
||||||
"build": "yarn compile && cp -r package.json yarn.lock README.md config/ views/ dist/ && mkdir dist/types && cp src/types/* dist/types/",
|
"build": "yarn prepare && yarn compile && cp -r yarn.lock README.md config/ views/ dist/ && mkdir dist/types && cp src/types/* dist/types/",
|
||||||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
|
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
|
||||||
"release": "yarn lint && yarn test && yarn build && cd dist && yarn publish"
|
"release": "yarn build && yarn lint && yarn test && cd dist && yarn publish"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/compression": "^1.7.0",
|
"@types/compression": "^1.7.0",
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
import Application from "../src/Application";
|
import Application from "./Application";
|
||||||
import Migration, {MigrationType} from "../src/db/Migration";
|
import Migration, {MigrationType} from "./db/Migration";
|
||||||
import ExpressAppComponent from "../src/components/ExpressAppComponent";
|
import ExpressAppComponent from "./components/ExpressAppComponent";
|
||||||
import RedisComponent from "../src/components/RedisComponent";
|
import RedisComponent from "./components/RedisComponent";
|
||||||
import MysqlComponent from "../src/components/MysqlComponent";
|
import MysqlComponent from "./components/MysqlComponent";
|
||||||
import NunjucksComponent from "../src/components/NunjucksComponent";
|
import NunjucksComponent from "./components/NunjucksComponent";
|
||||||
import LogRequestsComponent from "../src/components/LogRequestsComponent";
|
import LogRequestsComponent from "./components/LogRequestsComponent";
|
||||||
import MailComponent from "../src/components/MailComponent";
|
import MailComponent from "./components/MailComponent";
|
||||||
import SessionComponent from "../src/components/SessionComponent";
|
import SessionComponent from "./components/SessionComponent";
|
||||||
import AuthComponent from "../src/auth/AuthComponent";
|
import AuthComponent from "./auth/AuthComponent";
|
||||||
import FormHelperComponent from "../src/components/FormHelperComponent";
|
import FormHelperComponent from "./components/FormHelperComponent";
|
||||||
import ServeStaticDirectoryComponent from "../src/components/ServeStaticDirectoryComponent";
|
import ServeStaticDirectoryComponent from "./components/ServeStaticDirectoryComponent";
|
||||||
import {Express} from "express";
|
import {Express} from "express";
|
||||||
import MagicLinkAuthMethod from "../src/auth/magic_link/MagicLinkAuthMethod";
|
import MagicLinkAuthMethod from "./auth/magic_link/MagicLinkAuthMethod";
|
||||||
import PasswordAuthMethod from "../src/auth/password/PasswordAuthMethod";
|
import PasswordAuthMethod from "./auth/password/PasswordAuthMethod";
|
||||||
import {MAGIC_LINK_MAIL} from "./Mails";
|
import {MAGIC_LINK_MAIL} from "./Mails";
|
||||||
import CreateMigrationsTable from "./migrations/CreateMigrationsTable";
|
import CreateMigrationsTable from "./migrations/CreateMigrationsTable";
|
||||||
import CreateUsersAndUserEmailsTableMigration from "./auth/migrations/CreateUsersAndUserEmailsTableMigration";
|
import CreateUsersAndUserEmailsTableMigration from "./auth/migrations/CreateUsersAndUserEmailsTableMigration";
|
||||||
@ -29,7 +29,7 @@ import Controller from "./Controller";
|
|||||||
import AccountController from "./auth/AccountController";
|
import AccountController from "./auth/AccountController";
|
||||||
import MakeMagicLinksSessionNotUniqueMigration from "./auth/magic_link/MakeMagicLinksSessionNotUniqueMigration";
|
import MakeMagicLinksSessionNotUniqueMigration from "./auth/magic_link/MakeMagicLinksSessionNotUniqueMigration";
|
||||||
import AddUsedToMagicLinksMigration from "./auth/magic_link/AddUsedToMagicLinksMigration";
|
import AddUsedToMagicLinksMigration from "./auth/magic_link/AddUsedToMagicLinksMigration";
|
||||||
import packageJson = require('../package.json');
|
import packageJson = require('./package.json');
|
||||||
import PreviousUrlComponent from "./components/PreviousUrlComponent";
|
import PreviousUrlComponent from "./components/PreviousUrlComponent";
|
||||||
|
|
||||||
export const MIGRATIONS = [
|
export const MIGRATIONS = [
|
||||||
|
@ -191,7 +191,8 @@ export default class MagicLinkController<A extends Application> extends Controll
|
|||||||
|
|
||||||
if (!res.headersSent && user) {
|
if (!res.headersSent && user) {
|
||||||
// Auth success
|
// Auth success
|
||||||
req.flash('success', `Authentication success. Welcome, ${user.name}!`);
|
const name = user.asOptional(UserNameComponent)?.name;
|
||||||
|
req.flash('success', `Authentication success. Welcome${name ? `, ${name}` : ''}`);
|
||||||
res.redirect(req.getIntendedUrl() || Controller.route('home'));
|
res.redirect(req.getIntendedUrl() || Controller.route('home'));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -9,6 +9,8 @@ import UserEmail from "../auth/models/UserEmail";
|
|||||||
import UserApprovedComponent from "../auth/models/UserApprovedComponent";
|
import UserApprovedComponent from "../auth/models/UserApprovedComponent";
|
||||||
import {RequireAdminMiddleware, RequireAuthMiddleware} from "../auth/AuthComponent";
|
import {RequireAdminMiddleware, RequireAuthMiddleware} from "../auth/AuthComponent";
|
||||||
import NunjucksComponent from "../components/NunjucksComponent";
|
import NunjucksComponent from "../components/NunjucksComponent";
|
||||||
|
import ModelFactory from "../db/ModelFactory";
|
||||||
|
import UserNameComponent from "../auth/models/UserNameComponent";
|
||||||
|
|
||||||
export default class BackendController extends Controller {
|
export default class BackendController extends Controller {
|
||||||
private static readonly menu: BackendMenuElement[] = [];
|
private static readonly menu: BackendMenuElement[] = [];
|
||||||
@ -65,6 +67,7 @@ export default class BackendController extends Controller {
|
|||||||
.get();
|
.get();
|
||||||
res.render('backend/accounts_approval', {
|
res.render('backend/accounts_approval', {
|
||||||
accounts: accounts,
|
accounts: accounts,
|
||||||
|
has_user_name_component: ModelFactory.get(User).hasComponent(UserNameComponent),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@ import {delimiter} from "path";
|
|||||||
|
|
||||||
// Load config from specified path or default + swaf/config (default defaults)
|
// Load config from specified path or default + swaf/config (default defaults)
|
||||||
process.env['NODE_CONFIG_DIR'] =
|
process.env['NODE_CONFIG_DIR'] =
|
||||||
__dirname + '/../../node_modules/swaf/config/'
|
__dirname + '/../node_modules/swaf/config/'
|
||||||
+ delimiter
|
+ delimiter
|
||||||
+ (process.env['NODE_CONFIG_DIR'] || __dirname + '/../../config/');
|
+ (process.env['NODE_CONFIG_DIR'] || __dirname + '/../config/');
|
||||||
|
|
||||||
import {logger} from "./Logger";
|
import {logger} from "./Logger";
|
||||||
import TestApp from "./TestApp";
|
import TestApp from "./TestApp";
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ route('account') }}"><i data-feather="user"></i>
|
<a href="{{ route('account') }}"><i data-feather="user"></i>
|
||||||
<span class="tip">{{ user.name }}</span></a>
|
<span class="tip">{{ user.name | default('Account') }}</span></a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
|
@ -11,10 +11,7 @@
|
|||||||
"moduleResolution": "Node",
|
"moduleResolution": "Node",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"baseUrl": "dist",
|
"baseUrl": "dist",
|
||||||
"rootDirs": [
|
"rootDir": "src",
|
||||||
"src",
|
|
||||||
"config"
|
|
||||||
],
|
|
||||||
"sourceRoot": "src",
|
"sourceRoot": "src",
|
||||||
"inlineSourceMap": true,
|
"inlineSourceMap": true,
|
||||||
"inlineSources": true,
|
"inlineSources": true,
|
||||||
|
@ -10,7 +10,9 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="shrink-col">#</th>
|
<th class="shrink-col">#</th>
|
||||||
|
{% if has_user_name_component %}
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
|
{% endif %}
|
||||||
<th>Main email</th>
|
<th>Main email</th>
|
||||||
<th>Registered at</th>
|
<th>Registered at</th>
|
||||||
<th class="shrink-col">Action</th>
|
<th class="shrink-col">Action</th>
|
||||||
@ -20,7 +22,9 @@
|
|||||||
{% for user in accounts %}
|
{% for user in accounts %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ user.id }}</td>
|
<td>{{ user.id }}</td>
|
||||||
|
{% if has_user_name_component %}
|
||||||
<td>{{ user.name }}</td>
|
<td>{{ user.name }}</td>
|
||||||
|
{% endif %}
|
||||||
<td>{{ user.mainEmail.getOrFail().email | default('No email') }}</td>
|
<td>{{ user.mainEmail.getOrFail().email | default('No email') }}</td>
|
||||||
<td>{{ user.created_at.toISOString() }}</td>
|
<td>{{ user.created_at.toISOString() }}</td>
|
||||||
<td>
|
<td>
|
||||||
|
Loading…
Reference in New Issue
Block a user