Esempio n. 1
0
def password_reset(request):
    if request.method == 'POST':
        username = request.POST.get('username')
        if username == "":
            form = PasswordResetForm()
            return render_to_response('password_reset.html',
                    locals(),
                    context_instance=RequestContext(request),
                    )
        try:
            member = Member.objects.get(user__username=username)
            set_member_password(member)
            member.user.save()
            member.save()
        except Member.DoesNotExist:
            pass

        message = _("If your username exists, the new password is sent to the given mail address.")
        return render_to_response('password_reset.html',
                locals(),
                context_instance=RequestContext(request),
                )

    form = PasswordResetForm()
    return render_to_response('password_reset.html',
            locals(),
            context_instance=RequestContext(request),
            )
Esempio n. 2
0
                user.full_clean(exclude=["username",])
            except ValidationError, e:
                return input_error(form, e)
        else:
            user.username = new_username
            try:
                user.full_clean()
            except ValidationError, e:
                return input_error(form, e)

        # Now set member data

        # Handle passwords
        if not new_password == "":
            try:
                set_member_password(member, new_password)
            except EjabberdError as error:
                return input_error(form, error)


        new_member_type = request.POST.get('member_type')
        if not new_member_type == member.member_type:
            if is_god:
                member.member_type = new_member_type
            else:
                error=_("You may not change the member type")
                return input_error(form, error)

        member.begins      = request.POST.get('begins')
        member.expires     = request.POST.get('expires')