#NEWLINE# def email_change_confirm( self , request , extra_context = None , uidb36 = None , token = None , email = None , token_generator = email_token_generator ) : #NEWLINE# #INDENT# "\n\t\tChecks that ``token`` is valid, and if so, changes the user's email.\n\t\t\n\t\t:param token_generator: The token generator used to check the ``token``.\n\t\t\n\t\t" #NEWLINE# assert ( ( uidb36 is not None ) and ( token is not None ) and ( email is not None ) ) #NEWLINE# try : #NEWLINE# #INDENT# uid_int = base36_to_int ( uidb36 ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# raise Http404 #NEWLINE# #UNINDENT# user = get_object_or_404 ( User , id = uid_int ) #NEWLINE# email = '@' . join ( email . rsplit ( '+' , 1 ) ) #NEWLINE# if ( email == user . email ) : #NEWLINE# #INDENT# raise Http404 #NEWLINE# #UNINDENT# if token_generator . check_token ( user , email , token ) : #NEWLINE# #INDENT# self . account_form . set_email ( user , email ) #NEWLINE# messages . add_message ( request , messages . SUCCESS , 'Email changed successfully.' ) #NEWLINE# if self . manage_account_page : #NEWLINE# #INDENT# redirect = self . reverse ( 'account' , node = request . node ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# redirect = request . node . get_absolute_url ( ) #NEWLINE# #UNINDENT# return HttpResponseRedirect ( redirect ) #NEWLINE# #UNINDENT# raise Http404