def post(self, request, pk): self.company.account.set_random_password() backend.sync_accounts_with_ldap([self.company.account]) msg = _('Password has been reset.') messages.success(request, msg) if request.POST.get('perform_send'): n = backend.send_password_email_to_people(self.company) messages.success( request, 'Emails have been sent to %d person(s).' % n ) return redirect('management:companies_view', pk=self.company.pk)
def post(self, request, pk): obligation = self.company.obligation account = Account.objects.create_for_obligation(obligation) account.set_random_password() self.company.account = account self.company.save() backend.sync_accounts_with_ldap([account]) msg = "Account created." messages.success(request, msg) if request.POST.get('perform_send'): n = backend.send_password_email_to_people(self.company) messages.success( request, 'Emails have been sent to %d person(s).' % n ) return redirect('management:companies_view', pk=self.company.pk)