Backend/MailDomain: allow setting domain owner to public
This commit is contained in:
parent
4dede38da4
commit
21e327251a
|
@ -128,7 +128,7 @@ export default class MailboxBackendController extends Controller {
|
|||
.first();
|
||||
if (!domain) throw new NotFoundHttpError('Domain', req.url);
|
||||
|
||||
domain.user_id = req.body.user_id;
|
||||
domain.updateWithData(req.body);
|
||||
await domain.save();
|
||||
|
||||
req.flash('success', `Domain ${domain.name} updated successfully.`);
|
||||
|
|
|
@ -28,7 +28,8 @@ export default class MailDomain extends Model {
|
|||
}
|
||||
|
||||
protected init(): void {
|
||||
this.setValidation('name').defined().maxLength(252)
|
||||
this.setValidation('name').acceptUndefined()
|
||||
.maxLength(252)
|
||||
.regexp(/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/)
|
||||
.unique(this);
|
||||
this.setValidation('user_id').acceptUndefined().exists(User, 'id');
|
||||
|
|
Loading…
Reference in New Issue