Remove line about defining a quota because that's not that necessary and made the form ugly + simply controller code

This commit is contained in:
Alexandre Aubin 2020-11-02 20:23:13 +01:00
parent 4e1c5ce424
commit f0b1a0bbce
2 changed files with 12 additions and 27 deletions

View file

@ -197,25 +197,20 @@
// Create user (POST) // Create user (POST)
app.post('#/users/create', function (c) { app.post('#/users/create', function (c) {
if (c.params['password'] == c.params['confirmation']) { if (c.params['password'] != c.params['confirmation']) {
if (c.params['password'].length < PASSWORD_MIN_LENGTH) {
c.flash('fail', y18n.t('passwords_too_short'));
}
else {
// Force unit or disable quota
if (c.params['mailbox_quota']) {
c.params['mailbox_quota'] += "M";
}
else {c.params['mailbox_quota'] = 0;}
c.params['domain'] = c.params['domain'].slice(1);
c.api('POST', '/users', c.params.toHash(), function(data) {
c.redirect_to('#/users');
});
}
} else {
c.flash('fail', y18n.t('passwords_dont_match')); c.flash('fail', y18n.t('passwords_dont_match'));
return;
} }
if (c.params['password'].length < PASSWORD_MIN_LENGTH) {
c.flash('fail', y18n.t('passwords_too_short'));
return;
}
c.params['domain'] = c.params['domain'].slice(1);
c.api('POST', '/users', c.params.toHash(), function(data) {
c.redirect_to('#/users');
});
}); });
// Show user information // Show user information

View file

@ -57,16 +57,6 @@
</select> </select>
</div> </div>
</div> </div>
<div class="form-group">
<label for="mailbox-quota" class="col-sm-3 control-label">{{t 'user_mailbox_quota'}}</label>
<div class="col-sm-4">
<div class="input-group">
<input type="number" min="0" id="mailbox-quota" name="mailbox_quota" class="form-control" placeholder="{{t 'mailbox_quota_placeholder'}}">
<div class="input-group-addon">M</div>
</div>
<div class="help-block quota-help-block">{{t 'mailbox_quota_description'}}</div>
</div>
</div>
</div> </div>
</div> </div>