Make max public domain identity per user configurable, default unlimited
This commit is contained in:
parent
6399573432
commit
679e8ab769
|
@ -36,6 +36,8 @@
|
|||
allow_invalid_tls: true,
|
||||
from: 'contact@rainbox.email',
|
||||
from_name: 'Rainbox Email',
|
||||
// Unlimited
|
||||
max_public_identities_per_user: -1,
|
||||
},
|
||||
view: {
|
||||
cache: false,
|
||||
|
|
|
@ -6,4 +6,7 @@
|
|||
database: "rainbox_email_test",
|
||||
create_database_automatically: true
|
||||
},
|
||||
mail: {
|
||||
max_public_identities_per_user: 1,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ export default class AccountMailboxController extends Controller {
|
|||
}, req.body);
|
||||
const actualPublicAddressesCount = await mailIdentityComponent.getPublicAddressesCount();
|
||||
const maxPublicAddressesCount = mailIdentityComponent.getMaxPublicAddressesCount();
|
||||
if (actualPublicAddressesCount >= maxPublicAddressesCount) {
|
||||
if (maxPublicAddressesCount >= 0 && actualPublicAddressesCount >= maxPublicAddressesCount) {
|
||||
req.flash('error', 'You have reached maximum public email addresses.');
|
||||
res.redirect(Controller.route('account-mailbox'));
|
||||
return;
|
||||
|
|
|
@ -3,6 +3,7 @@ import User from "swaf/auth/models/User";
|
|||
import {ManyModelRelation, OneModelRelation} from "swaf/db/ModelRelation";
|
||||
import MailIdentity from "./MailIdentity";
|
||||
import MailDomain from "./MailDomain";
|
||||
import config from "config";
|
||||
|
||||
export default class UserMailIdentityComponent extends ModelComponent<User> {
|
||||
public main_mail_identity_id?: number = undefined;
|
||||
|
@ -27,7 +28,7 @@ export default class UserMailIdentityComponent extends ModelComponent<User> {
|
|||
});
|
||||
|
||||
public getMaxPublicAddressesCount(): number {
|
||||
return 1;
|
||||
return config.get<number>('mail.max_public_identities_per_user');
|
||||
}
|
||||
|
||||
public async getPublicAddressesCount(): Promise<number> {
|
||||
|
|
Loading…
Reference in New Issue