Some refactoring to aling it more with IVIS and coreui theme.

This commit is contained in:
Tomas Bures 2019-01-05 23:56:16 +01:00
parent 397f85dac4
commit c1731bf09f
50 changed files with 1427 additions and 2351 deletions

View file

@ -233,9 +233,10 @@ function createApp(appType) {
}
useWith404Fallback('/static', express.static(path.join(__dirname, '..', 'client', 'static')));
useWith404Fallback('/mailtrain', express.static(path.join(__dirname, '..', 'client', 'dist')));
useWith404Fallback('/client', express.static(path.join(__dirname, '..', 'client', 'dist')));
useWith404Fallback('/static-npm/fontawesome', express.static(path.join(__dirname, '..', 'client', 'node_modules', '@fortawesome', 'fontawesome-free', 'webfonts')));
useWith404Fallback('/static-npm/jquery.min.js', express.static(path.join(__dirname, '..', 'client', 'node_modules', 'jquery', 'dist', 'jquery.min.js')));
useWith404Fallback('/static-npm/popper.min.js', express.static(path.join(__dirname, '..', 'client', 'node_modules', 'popper.js', 'dist', 'umd', 'popper.min.js')));
useWith404Fallback('/static-npm/bootstrap.min.js', express.static(path.join(__dirname, '..', 'client', 'node_modules', 'bootstrap', 'dist', 'js', 'bootstrap.min.js')));
useWith404Fallback('/static-npm/coreui.min.js', express.static(path.join(__dirname, '..', 'client', 'node_modules', '@coreui', 'coreui', 'dist', 'js', 'coreui.min.js')));
@ -351,7 +352,7 @@ function createApp(appType) {
} else {
if (err instanceof interoperableErrors.NotLoggedInError) {
return res.redirect(getTrustedUrl('/account/login?next=' + encodeURIComponent(req.originalUrl)));
return res.redirect(getTrustedUrl('/login?next=' + encodeURIComponent(req.originalUrl)));
} else {
res.status(err.status || 500);
res.render('error', {
@ -395,7 +396,7 @@ function createApp(appType) {
// TODO: Render interoperable errors using a special client that does internationalization of the error message
if (err instanceof interoperableErrors.NotLoggedInError) {
return res.redirect(getTrustedUrl('/account/login?next=' + encodeURIComponent(req.originalUrl)));
return res.redirect(getTrustedUrl('/login?next=' + encodeURIComponent(req.originalUrl)));
} else {
res.status(err.status || 500);
res.render('error', {

View file

@ -225,11 +225,16 @@ seleniumWebDriver:
roles:
global:
master:
name: Master
name: Global Master
admin: true
description: All permissions
permissions: [rebuildPermissions, createJavascriptWithROAccess, manageBlacklist, manageSettings, setupAutomation]
rootNamespaceRole: master
campaignsAdmin:
name: Campaigns Admin
description: Under the namespace in which the user is located, the user has all permissions for managing lists, templates and campaigns and the permission to send to send configurations.
permissions: [setupAutomation]
ownNamespaceRole: campaignsAdmin
nobody:
name: None
description: No permissions
@ -251,6 +256,21 @@ roles:
mosaicoTemplate: [view, edit, delete, share, viewFiles, manageFiles]
namespace: [view, edit, delete, share, createNamespace, createList, createCustomForm, createReport, createReportTemplate, createTemplate, createMosaicoTemplate, createSendConfiguration, createCampaign, manageUsers]
campaignsAdmin:
name: Campaigns Admin
description: Under the namespace in which the user is located, the user has all permissions for managing lists, templates and campaigns and the permission to send to send configurations.
permissions: [view, edit, delete, share, createNamespace, createList, createCustomForm, createReport, createTemplate, createMosaicoTemplate, createCampaign]
children:
sendConfiguration: [viewPublic, sendWithoutOverrides, sendWithAllowedOverrides]
list: [view, edit, delete, share, viewFields, manageFields, viewSubscriptions, manageSubscriptions, viewSegments, manageSegments, viewImports, manageImports]
customForm: [view, edit, delete, share]
campaign: [view, edit, delete, share, viewFiles, manageFiles, viewAttachments, manageAttachments, viewTriggers, manageTriggers, send, viewStats, fetchRss]
template: [view, edit, delete, share, viewFiles, manageFiles]
report: [view, edit, delete, share, execute, viewContent, viewOutput]
reportTemplate: [view, share, execute]
mosaicoTemplate: [view, edit, delete, share, viewFiles, manageFiles]
namespace: [view, edit, delete, share, createNamespace, createList, createCustomForm, createReport, createTemplate, createMosaicoTemplate, createCampaign]
sendConfiguration:
master:
name: Master

View file

@ -264,7 +264,7 @@ async function getByUsername(username) {
async function getByUsernameIfPasswordMatch(context, username, password) {
try {
const user = await _getBy('username', username, ['password']);
const user = await _getBy(context, 'username', username, ['password']);
if (!await bcryptCompare(password, user.password)) {
throw new interoperableErrors.IncorrectPasswordError();
@ -324,7 +324,7 @@ async function sendPasswordReset(locale, usernameOrEmail) {
title: tUI('mailtrain', locale),
username: user.username,
name: user.name,
confirmUrl: getTrustedUrl(`/account/reset/${encodeURIComponent(user.username)}/${encodeURIComponent(resetToken)}`)
confirmUrl: getTrustedUrl(`login/reset/${encodeURIComponent(user.username)}/${encodeURIComponent(resetToken)}`)
}
});
}

View file

@ -2879,7 +2879,8 @@
},
"ansi-regex": {
"version": "2.1.1",
"bundled": true
"bundled": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
@ -3244,7 +3245,8 @@
},
"safe-buffer": {
"version": "5.1.1",
"bundled": true
"bundled": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@ -3292,6 +3294,7 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -3330,11 +3333,13 @@
},
"wrappy": {
"version": "1.0.2",
"bundled": true
"bundled": true,
"optional": true
},
"yallist": {
"version": "3.0.2",
"bundled": true
"bundled": true,
"optional": true
}
}
},
@ -6163,12 +6168,9 @@
"from": "github:openpgpjs/elliptic#e187e706e11fa51bcd20e46e5119054be4e2a4a6",
"requires": {
"bn.js": "^4.4.0",
"brorand": "^1.0.1",
"hash.js": "^1.0.0",
"hmac-drbg": "^1.0.0",
"inherits": "^2.0.1",
"minimalistic-assert": "^1.0.0",
"minimalistic-crypto-utils": "^1.0.0"
"minimalistic-assert": "^1.0.0"
}
},
"openpgp": {
@ -6447,22 +6449,16 @@
"commander": {
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz",
"integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=",
"requires": {
"graceful-readlink": ">= 1.0.0"
}
"integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ="
},
"elliptic": {
"version": "github:openpgpjs/elliptic#e187e706e11fa51bcd20e46e5119054be4e2a4a6",
"from": "github:openpgpjs/elliptic#e187e706e11fa51bcd20e46e5119054be4e2a4a6",
"requires": {
"bn.js": "^4.4.0",
"brorand": "^1.0.1",
"hash.js": "^1.0.0",
"hmac-drbg": "^1.0.0",
"inherits": "^2.0.1",
"minimalistic-assert": "^1.0.0",
"minimalistic-crypto-utils": "^1.0.0"
"minimalistic-assert": "^1.0.0"
}
},
"node-fetch": {

View file

@ -21,7 +21,7 @@ function getRouter(appType) {
reactCsrfToken: req.csrfToken(),
mailtrainConfig: JSON.stringify(mailtrainConfig),
scriptFiles: [
getTrustedUrl('mailtrain/root.js')
getTrustedUrl('client/root.js')
],
publicPath: getTrustedUrl()
});

View file

@ -45,7 +45,7 @@ function getRouter(appType) {
reactCsrfToken: req.csrfToken(),
mailtrainConfig: JSON.stringify(mailtrainConfig),
scriptFiles: [
getSandboxUrl('mailtrain/ckeditor-root.js')
getSandboxUrl('client/ckeditor-root.js')
],
publicPath: getSandboxUrl()
});

View file

@ -45,7 +45,7 @@ function getRouter(appType) {
reactCsrfToken: req.csrfToken(),
mailtrainConfig: JSON.stringify(mailtrainConfig),
scriptFiles: [
getSandboxUrl('mailtrain/codeeditor-root.js')
getSandboxUrl('client/codeeditor-root.js')
],
publicPath: getSandboxUrl()
});

View file

@ -45,7 +45,7 @@ function getRouter(appType) {
reactCsrfToken: req.csrfToken(),
mailtrainConfig: JSON.stringify(mailtrainConfig),
scriptFiles: [
getSandboxUrl('mailtrain/grapesjs-root.js')
getSandboxUrl('client/grapesjs-root.js')
],
publicPath: getSandboxUrl()
});

View file

@ -201,7 +201,7 @@ function getRouter(appType) {
reactCsrfToken: req.csrfToken(),
mailtrainConfig: JSON.stringify(mailtrainConfig),
scriptFiles: [
getSandboxUrl('mailtrain/mosaico-root.js')
getSandboxUrl('client/mosaico-root.js')
],
publicPath: getSandboxUrl()
});

View file

@ -7,9 +7,9 @@ module.exports = {
url: '/users/login',
elementsToWaitFor: ['submitButton'],
elements: {
usernameInput: 'form[action="/account/login"] input[name="username"]',
passwordInput: 'form[action="/account/login"] input[name="password"]',
submitButton: 'form[action="/account/login"] [type=submit]'
usernameInput: 'form[action="/login"] input[name="username"]',
passwordInput: 'form[action="/login"] input[name="password"]',
submitButton: 'form[action="/login"] [type=submit]'
}
}),

View file

@ -12,10 +12,9 @@
<title>Mailtrain</title>
<link rel="stylesheet" href="{{publicPath}}mailtrain/mailtrain.css">
<script src="{{publicPath}}static/jquery-3.3.1.min.js"></script>
<link rel="stylesheet" href="{{publicPath}}client/mailtrain.css">
<script src="{{publicPath}}static-npm/jquery.min.js"></script>
<script src="{{publicPath}}static-npm/popper.min.js"></script>
<script src="{{publicPath}}static-npm/bootstrap.min.js"></script>
<script src="{{publicPath}}static-npm/coreui.min.js"></script>

View file

@ -12,10 +12,9 @@
<title>Mailtrain</title>
<link rel="stylesheet" href="{{publicPath}}mailtrain/mailtrain.css">
<script src="{{publicPath}}static/jquery-3.3.1.min.js"></script>
<link rel="stylesheet" href="{{publicPath}}client/mailtrain.css">
<script src="{{publicPath}}static-npm/jquery.min.js"></script>
<script src="{{publicPath}}static-npm/popper.min.js"></script>
<script src="{{publicPath}}static-npm/bootstrap.min.js"></script>
<script src="{{publicPath}}static-npm/coreui.min.js"></script>

View file

@ -12,7 +12,7 @@
<title>Mailtrain</title>
<script src="{{publicPath}}static/jquery-3.3.1.min.js"></script>
<script src="{{publicPath}}static-npm/jquery.min.js"></script>
{{#if mailtrainConfig}}
<script>

View file

@ -14,10 +14,9 @@
{{#if title}} | {{title}}{{/if}}
</title>
<link rel="stylesheet" href="{{publicPath}}mailtrain/mailtrain.css">
<script src="{{publicPath}}static/jquery-3.3.1.min.js"></script>
<link rel="stylesheet" href="{{publicPath}}client/mailtrain.css">
<script src="{{publicPath}}static-npm/jquery.min.js"></script>
<script src="{{publicPath}}static-npm/popper.min.js"></script>
<script src="{{publicPath}}static-npm/bootstrap.min.js"></script>
<script src="{{publicPath}}static-npm/coreui.min.js"></script>