Exemplo n.º 1
0
Arquivo: views.py Projeto: kamni/zorna
def change_my_password(request):
    if not request.user.is_anonymous():
        from zorna.account.forms import AccountEditPasswordForm
        user = request.user
        if request.method == 'POST':
            form = AccountEditPasswordForm(data=request.POST)
            if form.is_valid():
                user.set_password(form.cleaned_data['password1'])
                user.save()
                return user_settings(request)
            else:
                form = AccountEditPasswordForm(data=request.POST)
        else:
            form = AccountEditPasswordForm()
        context = RequestContext(request)
        return render_to_response("account/change_my_password.html", {'form': form}, context_instance=context)
    else:
        return HttpResponseRedirect('/')
Exemplo n.º 2
0
Arquivo: views.py Projeto: kamni/zorna
def edit_user_password(request, user):
    baccess = SiteOptions.objects.is_access_valid(
        request.user, 'zorna_validate_registration')
    if request.user.is_superuser or baccess:
        from zorna.account.forms import AccountEditPasswordForm
        user = User.objects.get(pk=user)
        if request.method == 'POST':
            form = AccountEditPasswordForm(data=request.POST)
            if form.is_valid():
                user.set_password(form.cleaned_data['password1'])
                user.save()
                return HttpResponseRedirect(reverse('list_users'))
            else:
                form = AccountEditPasswordForm(data=request.POST)
        else:
            form = AccountEditPasswordForm()
        context = RequestContext(request)
        return render_to_response("account/edit_password_user.html", {'form': form, 'curuser': user}, context_instance=context)
    else:
        return HttpResponseRedirect('/')
Exemplo n.º 3
0
def change_my_password(request):
    if not request.user.is_anonymous():
        from zorna.account.forms import AccountEditPasswordForm
        user = request.user
        if request.method == 'POST':
            form = AccountEditPasswordForm(data=request.POST)
            if form.is_valid():
                user.set_password(form.cleaned_data['password1'])
                user.save()
                return user_settings(request)
            else:
                form = AccountEditPasswordForm(data=request.POST)
        else:
            form = AccountEditPasswordForm()
        context = RequestContext(request)
        return render_to_response("account/change_my_password.html",
                                  {'form': form},
                                  context_instance=context)
    else:
        return HttpResponseRedirect('/')
Exemplo n.º 4
0
def edit_user_password(request, user):
    baccess = SiteOptions.objects.is_access_valid(
        request.user, 'zorna_validate_registration')
    if request.user.is_superuser or baccess:
        from zorna.account.forms import AccountEditPasswordForm
        user = User.objects.get(pk=user)
        if request.method == 'POST':
            form = AccountEditPasswordForm(data=request.POST)
            if form.is_valid():
                user.set_password(form.cleaned_data['password1'])
                user.save()
                return HttpResponseRedirect(reverse('list_users'))
            else:
                form = AccountEditPasswordForm(data=request.POST)
        else:
            form = AccountEditPasswordForm()
        context = RequestContext(request)
        return render_to_response("account/edit_password_user.html", {
            'form': form,
            'curuser': user
        },
                                  context_instance=context)
    else:
        return HttpResponseRedirect('/')