mirror of
https://github.com/optim-enterprises-bv/Mailu.git
synced 2025-10-30 17:47:55 +00:00
Merge pull request #41 from XYunknown/master
Adding SQL Like format for aliases
This commit is contained in:
@@ -86,6 +86,8 @@ class UserReplyForm(Form):
|
|||||||
|
|
||||||
class AliasForm(Form):
|
class AliasForm(Form):
|
||||||
localpart = fields.StringField('Alias', [validators.DataRequired()])
|
localpart = fields.StringField('Alias', [validators.DataRequired()])
|
||||||
|
wildcard = fields.BooleanField(
|
||||||
|
'Use SQL Like Syntax (e.g. for catch-all aliases, admin-%@domain.com)')
|
||||||
destination = DestinationField('Destination')
|
destination = DestinationField('Destination')
|
||||||
comment = fields.StringField('Comment')
|
comment = fields.StringField('Comment')
|
||||||
submit = fields.SubmitField('Create')
|
submit = fields.SubmitField('Create')
|
||||||
|
|||||||
@@ -189,6 +189,7 @@ class Alias(Email):
|
|||||||
"""
|
"""
|
||||||
domain = db.relationship(Domain,
|
domain = db.relationship(Domain,
|
||||||
backref=db.backref('aliases', cascade='all, delete-orphan'))
|
backref=db.backref('aliases', cascade='all, delete-orphan'))
|
||||||
|
wildcard = db.Column(db.Boolean(), default=False)
|
||||||
destination = db.Column(CommaSeparatedList, nullable=False, default=[])
|
destination = db.Column(CommaSeparatedList, nullable=False, default=[])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ Create alias
|
|||||||
<form class="form" method="post" role="form">
|
<form class="form" method="post" role="form">
|
||||||
{{ form.hidden_tag() }}
|
{{ form.hidden_tag() }}
|
||||||
{{ macros.form_field(form.localpart, append='<span class="input-group-addon">@'+domain.name+'</span>') }}
|
{{ macros.form_field(form.localpart, append='<span class="input-group-addon">@'+domain.name+'</span>') }}
|
||||||
|
{{ macros.form_field(form.wildcard) }}
|
||||||
{{ macros.form_field(form.destination, id='destination') }}
|
{{ macros.form_field(form.destination, id='destination') }}
|
||||||
{{ macros.form_field(form.comment) }}
|
{{ macros.form_field(form.comment) }}
|
||||||
{{ macros.form_field(form.submit) }}
|
{{ macros.form_field(form.submit) }}
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
dbpath = /data/freeposte.db
|
dbpath = /data/freeposte.db
|
||||||
query =
|
query =
|
||||||
SELECT destination
|
SELECT destination
|
||||||
FROM alias
|
FROM alias
|
||||||
WHERE alias.email = '%s'
|
WHERE alias.email = '%s'
|
||||||
|
AND alias.wildcard = 0
|
||||||
|
UNION SELECT destination
|
||||||
|
FROM alias
|
||||||
|
WHERE '%s' LIKE alias.email
|
||||||
|
AND alias.wildcard = 1
|
||||||
|
LIMIT 1
|
||||||
|
|||||||
Reference in New Issue
Block a user