return False\r
\r
def get_absolute_url(self):\r
- return self.absolute_parent.get_absolute_url() + "#%d" % self.id\r
+ return self.abs_parent.get_absolute_url() + "#%d" % self.id\r
\r
def __unicode__(self):\r
return self.body\r
@property \r
def absolute_parent(self):\r
if not self.abs_parent_id:\r
- return self.leaf\r
+ return self\r
\r
- return self.abs_parent.leaf\r
+ return self.abs_parent\r
\r
@property\r
def summary(self):\r
def can_upload_files(self):\r
return self.reputation >= int(settings.REP_TO_UPLOAD)\r
\r
+ def check_password(self, old_passwd):\r
+ self.__dict__.update(self.__class__.objects.filter(id=self.id).values('password')[0])\r
+ return DjangoUser.check_password(self, old_passwd)\r
+\r
+\r
class Meta:\r
app_label = 'forum'\r
\r
auth_keys = user_.auth_keys.all()
- if user_.has_usable_password():
- FormClass = ChangePasswordForm
- else:
+ if request.user.is_superuser or (not user_.has_usable_password()):
FormClass = SetPasswordForm
+ else:
+ FormClass = ChangePasswordForm
if request.POST:
form = FormClass(request.POST, user=user_)
request.user.message_set.create(message=_("Your password was changed"))
else:
request.user.message_set.create(message=_("New password set"))
- FormClass = ChangePasswordForm
+ if not request.user.is_superuser:
+ form = ChangePasswordForm(user=user_)
user_.set_password(form.cleaned_data['password1'])
user_.save()
return HttpResponseRedirect(reverse('user_authsettings', kwargs={'id': user_.id}))
-
- form = FormClass(user=user_)
+ else:
+ form = FormClass(user=user_)
auth_keys_list = []