Merge branch 'master' into sso
This commit is contained in:
commit
42ef28d3ee
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -7,3 +7,6 @@
|
|||
local_settings.py
|
||||
build
|
||||
*.egg-info
|
||||
/.Trash*
|
||||
/.git
|
||||
/.idea
|
||||
|
|
|
@ -58,12 +58,12 @@ class DatabaseForm(forms.ModelForm):
|
|||
|
||||
|
||||
class DatabaseCreationForm(DatabaseUserCreationForm):
|
||||
username = forms.CharField(label=_("Username"), max_length=16,
|
||||
username = forms.CharField(label=_("Username"), max_length=32,
|
||||
required=False, validators=[validators.validate_name],
|
||||
help_text=_("Required. 16 characters or fewer. Letters, digits and "
|
||||
help_text=_("Required. 32 characters or fewer. Letters, digits and "
|
||||
"@/./+/-/_ only."),
|
||||
error_messages={
|
||||
'invalid': _("This value may contain 16 characters or fewer, only letters, numbers and "
|
||||
'invalid': _("This value may contain 32 characters or fewer, only letters, numbers and "
|
||||
"@/./+/-/_ characters.")})
|
||||
user = forms.ModelChoiceField(required=False, queryset=DatabaseUser.objects)
|
||||
|
||||
|
|
|
@ -213,6 +213,8 @@ class MailboxAdmin(ChangePasswordAdminMixin, SelectAccountAdminMixin, ExtendedMo
|
|||
old = Mailbox.objects.get(pk=obj.pk)
|
||||
if old.custom_filtering != obj.custom_filtering:
|
||||
messages.warning(request, msg)
|
||||
# pass var to the backend so you don't change the password
|
||||
obj.changepass = None
|
||||
elif obj.custom_filtering:
|
||||
messages.warning(request, msg)
|
||||
super(MailboxAdmin, self).save_model(request, obj, form, change)
|
||||
|
|
|
@ -69,13 +69,15 @@ class UNIXUserMaildirController(SieveFilteringMixin, ServiceController):
|
|||
self.append(textwrap.dedent("""
|
||||
# Update/create %(user)s user state
|
||||
if id %(user)s ; then
|
||||
old_password=$(getent shadow %(user)s | cut -d':' -f2)
|
||||
usermod %(user)s \\
|
||||
--shell %(initial_shell)s \\
|
||||
--password '%(password)s'
|
||||
if [[ "$old_password" != '%(password)s' ]]; then
|
||||
# Postfix SASL caches passwords
|
||||
RESTART_POSTFIX=1
|
||||
if [[ "%(changepass)s" == "True" ]]; then
|
||||
old_password=$(getent shadow %(user)s | cut -d':' -f2)
|
||||
usermod %(user)s \\
|
||||
--shell %(initial_shell)s \\
|
||||
--password '%(password)s'
|
||||
if [[ "$old_password" != '%(password)s' ]]; then
|
||||
# Postfix SASL caches passwords
|
||||
RESTART_POSTFIX=1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
useradd %(user)s \\
|
||||
|
@ -135,6 +137,11 @@ class UNIXUserMaildirController(SieveFilteringMixin, ServiceController):
|
|||
super().commit()
|
||||
|
||||
def get_context(self, mailbox):
|
||||
# Check if you have to change password
|
||||
try:
|
||||
changepass = mailbox.changepass
|
||||
except:
|
||||
changepass = True
|
||||
context = {
|
||||
'user': mailbox.name,
|
||||
'group': mailbox.name,
|
||||
|
@ -144,6 +151,7 @@ class UNIXUserMaildirController(SieveFilteringMixin, ServiceController):
|
|||
'maildir': os.path.join(mailbox.get_home(), 'Maildir'),
|
||||
'initial_shell': self.SHELL,
|
||||
'banner': self.get_banner(),
|
||||
'changepass': changepass,
|
||||
}
|
||||
context['deleted_home'] = settings.MAILBOXES_MOVE_ON_DELETE_PATH % context
|
||||
return context
|
||||
|
|
|
@ -19,7 +19,7 @@ class NextCloudAPIMixin(object):
|
|||
def validate_response(self, response):
|
||||
request = response.request
|
||||
context = (request.method, response.url, request.body, response.status_code)
|
||||
sys.stderr.write("%s %s '%s' HTTP %s\n" % context)
|
||||
# sys.stderr.write("%s %s '%s' HTTP %s\n" % context)
|
||||
if response.status_code != requests.codes.ok:
|
||||
raise RuntimeError("%s %s '%s' HTTP %s" % context)
|
||||
root = ET.fromstring(response.text)
|
||||
|
|
|
@ -11,7 +11,7 @@ class Migration(migrations.Migration):
|
|||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
# migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
|
@ -25,7 +25,7 @@ class Migration(migrations.Migration):
|
|||
('directory', models.CharField(blank=True, help_text="Optional directory relative to user's home.", max_length=256, verbose_name='directory')),
|
||||
('shell', models.CharField(choices=[('/dev/null', 'No shell, FTP only'), ('/bin/rssh', 'No shell, SFTP/RSYNC only'), ('/usr/bin/git-shell', 'No shell, GIT only'), ('/bin/bash', '/bin/bash')], default='/dev/null', max_length=32, verbose_name='shell')),
|
||||
('is_active', models.BooleanField(default=True, help_text='Designates whether this account should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
|
||||
('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='systemusers', to=settings.AUTH_USER_MODEL, verbose_name='Account')),
|
||||
# ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='systemusers', to=settings.AUTH_USER_MODEL, verbose_name='Account')),
|
||||
('groups', models.ManyToManyField(blank=True, help_text='A new group will be created for the user. Which additional groups would you like them to be a member of?', to='systemusers.SystemUser')),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -6,5 +6,4 @@ from orchestra.admin.utils import admin_date
|
|||
|
||||
display_last_run_at = admin_date('last_run_at', short_description=_("Last run"))
|
||||
|
||||
|
||||
PeriodicTaskAdmin.list_display = ('__unicode__', display_last_run_at, 'total_run_count', 'enabled')
|
||||
PeriodicTaskAdmin.list_display = ('__unicode__', display_last_run_at, 'total_run_count', 'enabled')
|
Loading…
Reference in a new issue