Example #1
0
def q_password(request, user_name=None):
    current_user = request.user

    try:
        user = User.objects.get(username=user_name)
    except User.DoesNotExist:
        if not user_name:
            msg = u"Please specify a user."
        else:
            msg = u"Unable to locate user '%s'" % (user_name)
        return q_error(request, error_msg=msg)
    if current_user.username != user_name:
        msg = u"You do not have permission to edit this user."
        return q_error(request, error_msg=msg)
    if not user.is_active:
        msg = u"This user's account has been disabled."
        return q_error(request, error_msg=msg)

    context = add_parameters_to_context(request)
    next_page = context.get("next", u"/users/%s" % user.username)

    return password_change_view(
        request,
        template_name='questionnaire/q_password.html',
        post_change_redirect=next_page,
        password_change_form=QUserPasswordForm,
    )
Example #2
0
def signup_change_password(request):
    return password_change_view(request, template_name='change_password.html',
                                post_change_redirect=settings.LOGIN_REDIRECT_URL)
Example #3
0
def signup_change_password(request):
    return password_change_view(request, template_name='signup/change_password.html',
                                post_change_redirect=settings.LOGIN_REDIRECT_URL)