Example #1
0
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)
Example #2
0
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/')
Example #3
0
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/')