#NEWLINE# @ secure_required #NEWLINE# def email_confirm( request , confirmation_key , template_name = 'userena/email_confirm_fail.html' , success_url = None , extra_context = None ) : #NEWLINE# #INDENT# '\n    Confirms an email address with a confirmation key.\n\n    Confirms a new email address by running :func:`User.objects.confirm_email`\n    method. If the method returns an :class:`User` the user will have his new\n    e-mail address set and redirected to ``success_url``. If no ``User`` is\n    returned the user will be represented with a fail message from\n    ``template_name``.\n\n    :param confirmation_key:\n        String with a SHA1 representing the confirmation key used to verify a\n        new email address.\n\n    :param template_name:\n        String containing the template name which should be rendered when\n        confirmation fails. When confirmation is successful, no template is\n        needed because the user will be redirected to ``success_url``.\n\n    :param success_url:\n        String containing the URL which is redirected to after a successful\n        confirmation.  Supplied argument must be able to be rendered by\n        ``reverse`` function.\n\n    :param extra_context:\n        Dictionary of variables that are passed on to the template supplied by\n        ``template_name``.\n\n    ' #NEWLINE# user = UserenaSignup . objects . confirm_email ( confirmation_key ) #NEWLINE# if user : #NEWLINE# #INDENT# if userena_settings . USERENA_USE_MESSAGES : #NEWLINE# #INDENT# messages . success ( request , _ ( 'Your email address has been changed.' ) , fail_silently = True ) #NEWLINE# #UNINDENT# if success_url : #NEWLINE# #INDENT# redirect_to = success_url #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# redirect_to = reverse ( 'userena_email_confirm_complete' , kwargs = { #NEWLINE# #INDENT# 'username' : user . username , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# return redirect ( redirect_to ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not extra_context ) : #NEWLINE# #INDENT# extra_context = dict ( ) #NEWLINE# #UNINDENT# return ExtraContextTemplateView . as_view ( template_name = template_name , extra_context = extra_context ) ( request )