def root(request): if request.method == 'POST': form = PasswordForm(request.POST) if form.is_valid(): request.user.set_password(form.cleaned_data['password']) else: messages.add_message(request, messages.ERROR, _(u'Password invalid')) return table(request)
def root(request, form=None): if request.user.is_authenticated(): if request.method == 'POST': form = PasswordForm(request.POST) if form.is_valid(): request.user.set_password(form.cleaned_data['password']) request.user.save() messages.add_message(request, messages.SUCCESS, _(u'Successfully changed password')) else: messages.add_message(request, messages.ERROR, _(u'Password invalid')) return table(request) else: return HttpResponseRedirect('/local_login/')
def root(request, form=None): if request.user.is_authenticated: if request.method == 'POST': form = PasswordForm(request.POST) if form.is_valid(): request.user.set_password(form.cleaned_data['password']) request.user.save() messages.add_message(request, messages.SUCCESS, _(u'Successfully changed password')) else: messages.add_message(request, messages.ERROR, _(u'Password invalid')) return table(request) else: return HttpResponseRedirect('/local_login/')
def root(request): return table(request)