Exemplo n.º 1
0
 def clean_password_2(self):
     # Could get pwd_1 here, but no point - the overall clean
     # routine will flag the whole form if they don't match
     pwd_2 = self.cleaned_data['password_2'].strip()        
     if pwd_2:
         return clean_password(self.cleaned_data.get('password_2'))
     return pwd_2
Exemplo n.º 2
0
 def clean_password_1(self):
     # Can't get pwd_2 here yet; it hasn't been put in cleaned_data
     pwd_1 = self.cleaned_data['password_1'].strip()        
     if pwd_1:
         return clean_password(self.cleaned_data.get('password_1'))
     return pwd_1
Exemplo n.º 3
0
from django.contrib.auth.models import User
from django.contrib.auth.forms import PasswordChangeForm, SetPasswordForm
from django.shortcuts import render_to_response
from django.template import RequestContext

from domain.decorators import login_and_domain_required
from domain.forms import clean_password
from HQTest.forms import UpdateSelfForm, UpdateSelfTable
from common_code.debug_client import console_msg as cm

########################################################################################################
# Monekypatch the built-in auth password change and reset forms so that they enforces the same password 
# restrictions defined in the domain app

PasswordChangeForm.clean_new_password1 = lambda self : clean_password(self.cleaned_data.get('new_password1'))
PasswordChangeForm.clean_new_password2 = lambda self : clean_password(self.cleaned_data.get('new_password2'))
SetPasswordForm.clean_new_password1 = lambda self : clean_password(self.cleaned_data.get('new_password1'))
SetPasswordForm.clean_new_password2 = lambda self : clean_password(self.cleaned_data.get('new_password2'))

########################################################################################################

@login_and_domain_required
def homepage(request):
    vals = dict()
    return render_to_response('homepage.html',  vals, context_instance = RequestContext(request))                              

########################################################################################################

@login_and_domain_required
def admin_own_account_main(request):
    return render_to_response('admin_own_account_main.html',  {}, context_instance = RequestContext(request))