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