Merge branch 'develop'

This commit is contained in:
Alice Gaudon 2021-05-28 14:51:31 +02:00
commit bce1796115
6 changed files with 996 additions and 1474 deletions

View File

@ -36,6 +36,8 @@
allow_invalid_tls: true, allow_invalid_tls: true,
from: 'contact@rainbox.email', from: 'contact@rainbox.email',
from_name: 'Rainbox Email', from_name: 'Rainbox Email',
// Unlimited
max_public_identities_per_user: -1,
}, },
view: { view: {
cache: false, cache: false,

View File

@ -6,4 +6,7 @@
database: "rainbox_email_test", database: "rainbox_email_test",
create_database_automatically: true create_database_automatically: true
}, },
mail: {
max_public_identities_per_user: 1,
},
} }

View File

@ -1,8 +1,8 @@
{ {
"name": "rainbox.email", "name": "rainbox.email",
"version": "2.4.1", "version": "2.4.2",
"description": "ISP mail provider manager with mysql and integrated LDAP server", "description": "ISP mail provider manager with mysql and integrated LDAP server",
"repository": "https://gitlab.com/ArisuOngaku/rainbox.email", "repository": "https://eternae.ink/ashpie/rainbox.email",
"author": "Alice Gaudon <alice@gaudon.pro>", "author": "Alice Gaudon <alice@gaudon.pro>",
"main": "dist/main.js", "main": "dist/main.js",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
@ -28,7 +28,7 @@
"@types/jest": "^26.0.4", "@types/jest": "^26.0.4",
"@types/ldapjs": "^1.0.7", "@types/ldapjs": "^1.0.7",
"@types/mysql": "^2.15.15", "@types/mysql": "^2.15.15",
"@types/node": "^14.6.3", "@types/node": "^15.0.1",
"@types/nodemailer": "^6.4.0", "@types/nodemailer": "^6.4.0",
"@types/nunjucks": "^3.1.3", "@types/nunjucks": "^3.1.3",
"@types/ws": "^7.2.6", "@types/ws": "^7.2.6",
@ -40,7 +40,7 @@
"eslint": "^7.10.0", "eslint": "^7.10.0",
"feather-icons": "^4.28.0", "feather-icons": "^4.28.0",
"file-loader": "^6.0.0", "file-loader": "^6.0.0",
"imagemin": "^7.0.1", "imagemin": "^7.0.0",
"imagemin-gifsicle": "^7.0.0", "imagemin-gifsicle": "^7.0.0",
"imagemin-mozjpeg": "^9.0.0", "imagemin-mozjpeg": "^9.0.0",
"imagemin-pngquant": "^9.0.0", "imagemin-pngquant": "^9.0.0",
@ -49,12 +49,12 @@
"jest": "^26.1.0", "jest": "^26.1.0",
"maildev": "^1.1.0", "maildev": "^1.1.0",
"mini-css-extract-plugin": "^1.2.1", "mini-css-extract-plugin": "^1.2.1",
"node-sass": "^5.0.0",
"nodemon": "^2.0.3", "nodemon": "^2.0.3",
"sass": "^1.32.12",
"sass-loader": "^11.0.1", "sass-loader": "^11.0.1",
"terser-webpack-plugin": "^5.0.3", "terser-webpack-plugin": "^5.0.3",
"ts-jest": "^26.1.1", "ts-jest": "^26.1.1",
"ts-loader": "^8.0.4", "ts-loader": "^9.1.0",
"typescript": "^4.0.2", "typescript": "^4.0.2",
"webpack": "^5.3.2", "webpack": "^5.3.2",
"webpack-cli": "^4.1.0" "webpack-cli": "^4.1.0"

View File

@ -66,7 +66,7 @@ export default class AccountMailboxController extends Controller {
}, req.body); }, req.body);
const actualPublicAddressesCount = await mailIdentityComponent.getPublicAddressesCount(); const actualPublicAddressesCount = await mailIdentityComponent.getPublicAddressesCount();
const maxPublicAddressesCount = mailIdentityComponent.getMaxPublicAddressesCount(); const maxPublicAddressesCount = mailIdentityComponent.getMaxPublicAddressesCount();
if (actualPublicAddressesCount >= maxPublicAddressesCount) { if (maxPublicAddressesCount >= 0 && actualPublicAddressesCount >= maxPublicAddressesCount) {
req.flash('error', 'You have reached maximum public email addresses.'); req.flash('error', 'You have reached maximum public email addresses.');
res.redirect(Controller.route('account-mailbox')); res.redirect(Controller.route('account-mailbox'));
return; return;

View File

@ -3,6 +3,7 @@ import User from "swaf/auth/models/User";
import {ManyModelRelation, OneModelRelation} from "swaf/db/ModelRelation"; import {ManyModelRelation, OneModelRelation} from "swaf/db/ModelRelation";
import MailIdentity from "./MailIdentity"; import MailIdentity from "./MailIdentity";
import MailDomain from "./MailDomain"; import MailDomain from "./MailDomain";
import config from "config";
export default class UserMailIdentityComponent extends ModelComponent<User> { export default class UserMailIdentityComponent extends ModelComponent<User> {
public main_mail_identity_id?: number = undefined; public main_mail_identity_id?: number = undefined;
@ -27,7 +28,7 @@ export default class UserMailIdentityComponent extends ModelComponent<User> {
}); });
public getMaxPublicAddressesCount(): number { public getMaxPublicAddressesCount(): number {
return 1; return config.get<number>('mail.max_public_identities_per_user');
} }
public async getPublicAddressesCount(): Promise<number> { public async getPublicAddressesCount(): Promise<number> {

2448
yarn.lock

File diff suppressed because it is too large Load Diff