Exemple #1
0
    def get(self, encoded_email):
        try:
            email = utils.decode(encoded_email)
            user = models.User.get_by_email(email)

            if (user.activated == False):
                # send email
                subject = config.app_name + " Account Verification Email"
                encoded_email = utils.encode(email)
                confirmation_url = self.uri_for("account-activation",
                                                encoded_email=encoded_email,
                                                _full=True)

                # load email's template
                template_val = {
                    "app_name": config.app_name,
                    "username": user.username,
                    "confirmation_url": confirmation_url,
                    "support_url": self.uri_for("contact", _full=True)
                }
                body_path = "emails/account_activation.txt"
                body = self.jinja2.render_template(body_path, **template_val)

                email_url = self.uri_for('taskqueue-send-email')
                taskqueue.add(url=email_url,
                              params={
                                  'to': str(email),
                                  'subject': subject,
                                  'body': body,
                              })

                message = _('The verification email has been resent to') + " " + str(email) + ". " +\
                    _('Please check your email to activate your account')
                self.add_message(message, "success")
                return self.redirect_to('home')
            else:
                message = _('Your account has been activated') + ". " +\
                    _('Please login to your account')
                self.add_message(message, "warning")
                return self.redirect_to('home')

        except (KeyError, AttributeError), e:
            message = _('Sorry') + ". " + _('Some error occurred') + "."
            self.add_message(message, "error")
            return self.redirect_to('home')
Exemple #2
0
 def get(self, encoded_email):
     try:
         email = utils.decode(encoded_email)
         user = models.User.get_by_email(email)
         
         if (user.activated == False):
             # send email
             subject = config.app_name + " Account Verification Email"
             encoded_email = utils.encode(email)
             confirmation_url = self.uri_for("account-activation",
                 encoded_email = encoded_email,
                 _full = True)
             
             # load email's template
             template_val = {
                 "app_name": config.app_name,
                 "username": user.username,
                 "confirmation_url": confirmation_url,
                 "support_url": self.uri_for("contact", _full=True)
             }
             body_path = "emails/account_activation.txt"
             body = self.jinja2.render_template(body_path, **template_val)
             
             email_url = self.uri_for('taskqueue-send-email')
             taskqueue.add(url = email_url, params={
                 'to': str(email),
                 'subject' : subject,
                 'body' : body,
                 })
                 
             message = _('The verification email has been resent to') + " " + str(email) + ". " +\
                 _('Please check your email to activate your account')
             self.add_message(message, "success")
             return self.redirect_to('home')
         else:
             message = _('Your account has been activated') + ". " +\
                 _('Please login to your account')
             self.add_message(message, "warning")
             return self.redirect_to('home')
             
     except (KeyError, AttributeError), e:
         message = _('Sorry') + ". " + _('Some error occured') + "."
         self.add_message(message, "error")
         return self.redirect_to('home')
Exemple #3
0
    def post(self):
        """ Get fields from POST dict """
        email = self.form.email.data.lower()

        user_info = models.User.get_by_email(email)
        #if (user_info.activated == False):
        if True:
            # send email
            subject = _("StackGeek Signup Link")
            encoded_email = utils.encode(email)
            confirmation_url = self.uri_for("register",
                                            encoded_email=encoded_email,
                                            _full=True)

            # load email's template
            template_val = {
                "app_name": config.app_name,
                "confirmation_url": confirmation_url,
                "support_url": self.uri_for("contact", _full=True)
            }
            body_path = "emails/email_validation.txt"
            body = self.jinja2.render_template(body_path, **template_val)

            email_url = self.uri_for('taskqueue-send-email')
            taskqueue.add(url=email_url,
                          params={
                              'to': str(email),
                              'subject': subject,
                              'body': body,
                          })

        message = _(
            'Please check your email for an account activation token.  You can close this page if you like.'
        )
        self.add_message(message, 'info')

        # redirect to signup page if we're running in dev
        if os.environ['SERVER_SOFTWARE'].startswith('Dev'):
            return self.redirect('/register/%s/' % encoded_email)
        else:
            return self.redirect_to('preregister')
    def post(self):
        """ Get fields from POST dict """
        email = self.form.email.data.lower()

        user_info = models.User.get_by_email(email)
        #if (user_info.activated == False):
        if True:
            # send email
            subject =  _("StackGeek Signup Link")
            encoded_email = utils.encode(email)
            confirmation_url = self.uri_for("register",
                encoded_email = encoded_email,
                _full = True)

            # load email's template
            template_val = {
                "app_name": config.app_name,
                "confirmation_url": confirmation_url,
                "support_url": self.uri_for("contact", _full=True)
            }
            body_path = "emails/email_validation.txt"
            body = self.jinja2.render_template(body_path, **template_val)

            email_url = self.uri_for('taskqueue-send-email')
            taskqueue.add(url = email_url, params={
                'to': str(email),
                'subject' : subject,
                'body' : body,
                })

        message = _('Please check your email for an account activation token.  You can close this page if you like.')
        self.add_message(message, 'info')

        # redirect to signup page if we're running in dev
        if os.environ['SERVER_SOFTWARE'].startswith('Dev'):
            return self.redirect('/register/%s/' % encoded_email)
        else:
            return self.redirect_to('preregister')
Exemple #5
0
	def post(self):
		""" Get fields from POST dict """

		if not self.form.validate():
			return self.get()
		new_email = self.form.new_email.data.strip()
		password = self.form.password.data.strip()

		try:
			user_info = models.User.get_by_id(long(self.user_id))
			auth_id = "own:%s" % user_info.username
			# Password to SHA512
			password = utils.hashing(password, self.app.config.get('salt'))

			try:
				# authenticate user by its password
				user = models.User.get_by_auth_password(auth_id, password)

				# if the user change his/her email address
				if new_email != user.email:

					# check whether the new email has been used by another user
					aUser = models.User.get_by_email(new_email)
					if aUser is not None:
						message = _("The email %s is already registered." % new_email)
						self.add_message(message, 'error')
						return self.redirect_to("edit-email")

					# send email
					subject = _("%s Email Changed Notification" % self.app.config.get('app_name'))
					user_token = models.User.create_auth_token(self.user_id)
					confirmation_url = self.uri_for("email-changed-check",
						user_id = user_info.get_id(),
						encoded_email = utils.encode(new_email),
						token = user_token,
						_full = True)

					# load email's template
					template_val = {
						"app_name": self.app.config.get('app_name'),
						"first_name": user.name,
						"username": user.username,
						"new_email": new_email,
						"confirmation_url": confirmation_url,
						"support_url": self.uri_for("contact", _full=True)
					}

					old_body_path = "emails/email_changed_notification_old.txt"
					old_body = self.jinja2.render_template(old_body_path, **template_val)

					new_body_path = "emails/email_changed_notification_new.txt"
					new_body = self.jinja2.render_template(new_body_path, **template_val)

					email_url = self.uri_for('taskqueue-send-email')
					taskqueue.add(url = email_url, params={
						'to': user.email,
						'subject' : subject,
						'body' : old_body,
						})
					taskqueue.add(url = email_url, params={
						'to': new_email,
						'subject' : subject,
						'body' : new_body,
						})

					# display successful message
					msg = _("Please check your new email for confirmation. Your email will be updated after confirmation.")
					self.add_message(msg, 'success')
					return self.redirect_to('edit-profile')

				else:
					self.add_message(_("You didn't change your email."), "warning")
					return self.redirect_to("edit-email")


			except (InvalidAuthIdError, InvalidPasswordError), e:
				# Returns error message to self.response.write in
				# the BaseHandler.dispatcher
				message = _("Incorrect password! Please enter your current password to change your account settings.")
				self.add_message(message, 'error')
				return self.redirect_to('edit-email')

		except (AttributeError,TypeError), e:
			login_error_message = _('Sorry you are not logged in.')
			self.add_message(login_error_message,'error')
			self.redirect_to('login')
Exemple #6
0
    def post(self):
        """ Get fields from POST dict """

        if not self.form.validate():
            return self.get()
        new_email = self.form.new_email.data.strip()
        password = self.form.password.data.strip()

        try:
            user_info = models.User.get_by_id(long(self.user_id))
            auth_id = "own:%s" % user_info.username
            # Password to SHA512
            password = utils.encrypt(password, config.salt)

            try:
                # authenticate user by its password
                user = models.User.get_by_auth_password(auth_id, password)

                # if the user change his/her email address
                if new_email != user.email:

                    # check whether the new email has been used by another user
                    aUser = models.User.get_by_email(new_email)
                    if aUser is not None:
                        message = _("The email %s is already registered." %
                                    new_email)
                        self.add_message(message, "error")
                        return self.redirect_to("edit-email")

                    # send email
                    subject = config.app_name + " Email Changed Notification"
                    user_token = models.User.create_auth_token(self.user_id)
                    confirmation_url = self.uri_for(
                        "email-changed-check",
                        user_id=user_info.get_id(),
                        encoded_email=utils.encode(new_email),
                        token=user_token,
                        _full=True)

                    # load email's template
                    template_val = {
                        "app_name": config.app_name,
                        "first_name": user.name,
                        "username": user.username,
                        "new_email": new_email,
                        "confirmation_url": confirmation_url,
                        "support_url": self.uri_for("contact", _full=True)
                    }

                    old_body_path = "emails/email_changed_notification_old.txt"
                    old_body = self.jinja2.render_template(
                        old_body_path, **template_val)

                    new_body_path = "emails/email_changed_notification_new.txt"
                    new_body = self.jinja2.render_template(
                        new_body_path, **template_val)

                    email_url = self.uri_for('taskqueue-send-email')
                    taskqueue.add(url=email_url,
                                  params={
                                      'to': user.email,
                                      'subject': subject,
                                      'body': old_body,
                                  })
                    email_url = self.uri_for('taskqueue-send-email')
                    taskqueue.add(url=email_url,
                                  params={
                                      'to': new_email,
                                      'subject': subject,
                                      'body': new_body,
                                  })

                    logging.error(user)

                    # display successful message
                    msg = _(
                        "Please check your new email for confirmation. Your email will be updated after confirmation."
                    )
                    self.add_message(msg, 'success')
                    return self.redirect_to('edit-profile')

                else:
                    self.add_message(_("You didn't change your email"),
                                     "warning")
                    return self.redirect_to("edit-email")

            except (InvalidAuthIdError, InvalidPasswordError), e:
                # Returns error message to self.response.write in
                # the BaseHandler.dispatcher
                message = _("Your password is wrong, please try again")
                self.add_message(message, 'error')
                return self.redirect_to('edit-email')

        except (AttributeError, TypeError), e:
            login_error_message = _('Sorry you are not logged in!')
            self.add_message(login_error_message, 'error')
            self.redirect_to('login')
Exemple #7
0
    def post(self):
        """
        username: Get the username from POST dict
        password: Get the password from POST dict
        """

        if not self.form.validate():
            return self.get()
        username = self.form.username.data.lower()

        try:
            if utils.is_email_valid(username):
                user = models.User.get_by_email(username)
                if user:
                    auth_id = user.auth_ids[0]
                else:
                    raise InvalidAuthIdError
            else:
                auth_id = "own:%s" % username
                user = models.User.get_by_auth_id(auth_id)

            password = self.form.password.data.strip()
            remember_me = True if str(
                self.request.POST.get('remember_me')) == 'on' else False

            # Password to SHA512
            password = utils.encrypt(password, config.salt)

            # Try to login user with password
            # Raises InvalidAuthIdError if user is not found
            # Raises InvalidPasswordError if provided password
            # doesn't match with specified user
            self.auth.get_user_by_password(auth_id,
                                           password,
                                           remember=remember_me)

            # if user account is not activated, logout and redirect to home
            if (user.activated == False):
                # logout
                self.auth.unset_session()

                # redirect to home with error message
                resend_email_uri = self.uri_for('resend-account-activation',
                                                encoded_email=utils.encode(
                                                    user.email))
                message = _('Sorry, your account') + ' <strong>{0:>s}</strong>'.format(username) + " " +\
                          _('has not been activated. Please check your email to activate your account') + ". " +\
                          _('Or click') + " <a href='"+resend_email_uri+"'>" + _('this') + "</a> " + _('to resend the email')
                self.add_message(message, 'error')
                return self.redirect_to('home')

            # check twitter association in session
            twitter_helper = twitter.TwitterAuth(self)
            twitter_association_data = twitter_helper.get_association_data()
            if twitter_association_data is not None:
                if models.SocialUser.check_unique(
                        user.key, 'twitter',
                        str(twitter_association_data['id'])):
                    social_user = models.SocialUser(
                        user=user.key,
                        provider='twitter',
                        uid=str(twitter_association_data['id']),
                        extra_data=twitter_association_data)
                    social_user.put()

            logVisit = models.LogVisit(user=user.key,
                                       uastring=self.request.user_agent,
                                       ip=self.request.remote_addr,
                                       timestamp=utils.get_date_time())
            logVisit.put()
            self.redirect_to('home')
        except (InvalidAuthIdError, InvalidPasswordError), e:
            # Returns error message to self.response.write in
            # the BaseHandler.dispatcher
            message = _("Login invalid, Try again.") + "<br/>" + _("Don't have an account?") + \
                    '  <a href="' + self.uri_for('register') + '">' + _("Sign Up") + '</a>'
            self.add_message(message, 'error')
            return self.redirect_to('login')
Exemple #8
0
    def post(self):
        """ Get fields from POST dict """

        if not self.form.validate():
            return self.get()
        username = self.form.username.data.lower()
        name = self.form.name.data.strip()
        last_name = self.form.last_name.data.strip()
        email = self.form.email.data.lower()
        password = self.form.password.data.strip()
        country = self.form.country.data

        # Password to SHA512
        password = utils.encrypt(password, config.salt)

        # Passing password_raw=password so password will be hashed
        # Returns a tuple, where first value is BOOL.
        # If True ok, If False no new user is created
        unique_properties = ['username', 'email']
        auth_id = "own:%s" % username
        user = self.auth.store.user_model.create_user(auth_id,
                                                      unique_properties,
                                                      password_raw=password,
                                                      username=username,
                                                      name=name,
                                                      last_name=last_name,
                                                      email=email,
                                                      country=country,
                                                      activated=False)

        if not user[0]:  #user is a tuple
            message = _('Sorry, This user') + ' <strong>{0:>s}</strong>'.format(username) + " " +\
                      _('is already registered.')
            self.add_message(message, 'error')
            return self.redirect_to('register')
        else:
            # User registered successfully
            # But if the user registered using the form, the user has to check their email to activate the account ???
            try:
                user_info = models.User.get_by_email(email)
                if (user_info.activated == False):
                    # send email
                    subject = config.app_name + " Account Verification Email"
                    encoded_email = utils.encode(email)
                    confirmation_url = self.uri_for(
                        "account-activation",
                        encoded_email=encoded_email,
                        _full=True)

                    # load email's template
                    template_val = {
                        "app_name": config.app_name,
                        "username": username,
                        "confirmation_url": confirmation_url,
                        "support_url": self.uri_for("contact", _full=True)
                    }
                    body_path = "emails/account_activation.txt"
                    body = self.jinja2.render_template(body_path,
                                                       **template_val)

                    email_url = self.uri_for('taskqueue-send-email')
                    taskqueue.add(url=email_url,
                                  params={
                                      'to': str(email),
                                      'subject': subject,
                                      'body': body,
                                  })

                    message = _('Congratulations') + ", " + str(username) + "! " + _('You are now registered') +\
                              ". " + _('Please check your email to activate your account')
                    self.add_message(message, 'success')
                    return self.redirect_to('home')

                # If the user didn't register using registration form ???
                db_user = self.auth.get_user_by_password(
                    user[1].auth_ids[0], password)
                # Check twitter association in session
                twitter_helper = twitter.TwitterAuth(self)
                twitter_association_data = twitter_helper.get_association_data(
                )
                if twitter_association_data is not None:
                    if models.SocialUser.check_unique(
                            user[1].key, 'twitter',
                            str(twitter_association_data['id'])):
                        social_user = models.SocialUser(
                            user=user[1].key,
                            provider='twitter',
                            uid=str(twitter_association_data['id']),
                            extra_data=twitter_association_data)
                        social_user.put()
                message = _('Welcome') + " " + str(username) + ", " + _(
                    'you are now logged in.')
                self.add_message(message, 'success')
                return self.redirect_to('home')
            except (AttributeError, KeyError), e:
                message = _('Unexpected error creating '\
                            'user') + " " + '{0:>s}.'.format(username)
                self.add_message(message, 'error')
                self.abort(403)
Exemple #9
0
    def post(self):
        """
        username: Get the username from POST dict
        password: Get the password from POST dict
        """

        if not self.form.validate():
            return self.get()
        username = self.form.username.data.lower()
        
        try:
            if utils.is_email_valid(username):
                user = models.User.get_by_email(username)
                if user:
                    auth_id = user.auth_ids[0]
                else:
                    raise InvalidAuthIdError
            else:
                auth_id = "own:%s" % username
                user = models.User.get_by_auth_id(auth_id)
            
            password = self.form.password.data.strip()
            remember_me = True if str(self.request.POST.get('remember_me')) == 'on' else False
                
            # Password to SHA512
            password = utils.encrypt(password, config.salt)
    
            # Try to login user with password
            # Raises InvalidAuthIdError if user is not found
            # Raises InvalidPasswordError if provided password
            # doesn't match with specified user
            self.auth.get_user_by_password(
                auth_id, password, remember=remember_me)
                
            # if user account is not activated, logout and redirect to home
            if (user.activated == False):
                # logout
                self.auth.unset_session()
                
                # redirect to home with error message
                resend_email_uri = self.uri_for('resend-account-activation', encoded_email=utils.encode(user.email))
                message = _('Sorry, your account') + ' <strong>{0:>s}</strong>'.format(username) + " " +\
                          _('has not been activated. Please check your email to activate your account') + ". " +\
                          _('Or click') + " <a href='"+resend_email_uri+"'>" + _('this') + "</a> " + _('to resend the email')
                self.add_message(message, 'error')
                return self.redirect_to('home')

            #check twitter association in session
            twitter_helper = twitter.TwitterAuth(self)
            twitter_association_data = twitter_helper.get_association_data()
            if twitter_association_data is not None:
                if models.SocialUser.check_unique(user.key, 'twitter', str(twitter_association_data['id'])):
                    social_user = models.SocialUser(
                        user = user.key,
                        provider = 'twitter',
                        uid = str(twitter_association_data['id']),
                        extra_data = twitter_association_data
                    )
                    social_user.put()

            logVisit = models.LogVisit(
                user=user.key,
                uastring=self.request.user_agent,
                ip=self.request.remote_addr,
                timestamp=utils.get_date_time()
            )
            logVisit.put()
            self.redirect_to('home')
        except (InvalidAuthIdError, InvalidPasswordError), e:
            # Returns error message to self.response.write in
            # the BaseHandler.dispatcher
            message = _("Login invalid, Try again.") + "<br/>" + _("Don't have an account?") + \
                    '  <a href="' + self.uri_for('register') + '">' + _("Sign Up") + '</a>'
            self.add_message(message, 'error')
            return self.redirect_to('login')
Exemple #10
0
    def post(self):
        """ Get fields from POST dict """

        if not self.form.validate():
            return self.get()
        username = self.form.username.data.lower()
        name = self.form.name.data.strip()
        last_name = self.form.last_name.data.strip()
        email = self.form.email.data.lower()
        password = self.form.password.data.strip()
        country = self.form.country.data

        # Password to SHA512
        password = utils.encrypt(password, config.salt)

        # Passing password_raw=password so password will be hashed
        # Returns a tuple, where first value is BOOL.
        # If True ok, If False no new user is created
        unique_properties = ['username', 'email']
        auth_id = "own:%s" % username
        user = self.auth.store.user_model.create_user(
            auth_id, unique_properties, password_raw=password,
            username=username, name=name, last_name=last_name, email=email,
            country=country, activated=False
        )

        if not user[0]: #user is a tuple
            message = _('Sorry, This user') + ' <strong>{0:>s}</strong>'.format(username) + " " +\
                      _('is already registered.')
            self.add_message(message, 'error')
            return self.redirect_to('register')
        else:
            # User registered successfully
            # But if the user registered using the form, the user has to check their email to activate the account ???
            try:
                user_info = models.User.get_by_email(email)
                if (user_info.activated == False):
                    # send email
                    subject = config.app_name + " Account Verification Email"
                    encoded_email = utils.encode(email)
                    confirmation_url = self.uri_for("account-activation",
                        encoded_email = encoded_email,
                        _full = True)
                    
                    # load email's template
                    template_val = {
                        "app_name": config.app_name,
                        "username": username,
                        "confirmation_url": confirmation_url,
                        "support_url": self.uri_for("contact", _full=True)
                    }
                    body_path = "emails/account_activation.txt"
                    body = self.jinja2.render_template(body_path, **template_val)
                    
                    email_url = self.uri_for('taskqueue-send-email')
                    taskqueue.add(url = email_url, params={
                        'to': str(email),
                        'subject' : subject,
                        'body' : body,
                        })
                    
                    message = _('Congratulations') + ", " + str(username) + "! " + _('You are now registered') +\
                              ". " + _('Please check your email to activate your account')
                    self.add_message(message, 'success')
                    return self.redirect_to('home')
                
                # If the user didn't register using registration form ???
                db_user = self.auth.get_user_by_password(user[1].auth_ids[0], password)
                # Check twitter association in session
                twitter_helper = twitter.TwitterAuth(self)
                twitter_association_data = twitter_helper.get_association_data()
                if twitter_association_data is not None:
                    if models.SocialUser.check_unique(user[1].key, 'twitter', str(twitter_association_data['id'])):
                        social_user = models.SocialUser(
                            user = user[1].key,
                            provider = 'twitter',
                            uid = str(twitter_association_data['id']),
                            extra_data = twitter_association_data
                        )
                        social_user.put()
                message = _('Welcome') + " " + str(username) + ", " + _('you are now logged in.')
                self.add_message(message, 'success')
                return self.redirect_to('home')
            except (AttributeError, KeyError), e:
                message = _('Unexpected error creating '\
                            'user') + " " + '{0:>s}.'.format(username)
                self.add_message(message, 'error')
                self.abort(403)
Exemple #11
0
 def post(self):
     """
           Get fields from POST dict
     """
     new_email = self.request.POST.get('new_email').strip()
     password = self.request.POST.get('password').strip()
     
     if new_email == "" or password == "":
         message = 'Sorry, some fields are required.'
         self.add_message(message, 'error')
         return self.redirect_to('edit-email')
     
     if not utils.is_email_valid(new_email):
         message = 'Sorry, the email %s is not valid.' % new_email
         self.add_message(message, 'error')
         return self.redirect_to('edit-email')
     
     try:
         user_info = models.User.get_by_id(long(self.user_id))
         auth_id = "own:%s" % user_info.username
         # Password to SHA512
         password = utils.encrypt(password, config.salt)
         
         try:
             # authenticate user by its password
             user = models.User.get_by_auth_password(auth_id, password)
             
             # if the user change his/her email address
             if new_email != user.email:
                 
                 # check whether the new email has been used by another user
                 aUser = models.User.get_by_email(new_email)
                 if aUser is not None:
                     message = "The email %s is already registered. Want to <a href='/login/'>login</a> or <a href='/password-reset/'>recover your password</a>?" % new_email
                     self.add_message(message, "error")
                     return self.redirect_to("edit-email")
                 
                 # send email
                 subject = config.app_name + " Email Changed Notification"
                 user_token = models.User.create_auth_token(self.user_id)
                 confirmation_url = self.uri_for("email-changed-check", 
                     user_id = user_info.get_id(),
                     encoded_email = utils.encode(new_email),
                     token = user_token,
                     _full = True)
                 
                 # load email's template
                 template_val = {
                     "app_name": config.app_name,
                     "first_name": user.name,
                     "username": user.username,
                     "new_email": new_email,
                     "confirmation_url": confirmation_url,
                     "support_url": self.uri_for("contact", _full=True)
                 }
                 
                 old_body_path = "emails/email_changed_notification_old.txt"
                 old_body = self.jinja2.render_template(old_body_path, **template_val)
                 
                 new_body_path = "emails/email_changed_notification_new.txt"
                 new_body = self.jinja2.render_template(new_body_path, **template_val)
                 
                 utils.send_email(user.email, subject, old_body)
                 utils.send_email(new_email , subject, new_body)
                 
                 logging.error(user)
                 
                 # display successful message
                 msg = "Please check your new email for confirmation. "
                 msg += "Your email will be updated after confirmation. "
                 self.add_message(msg, 'success')
                 return self.redirect_to('secure')
                 
             else:
                 self.add_message("You didn't change your email", "warning")
                 return self.redirect_to("edit-email")
             
             
         except (InvalidAuthIdError, InvalidPasswordError), e:
             # Returns error message to self.response.write in
             # the BaseHandler.dispatcher
             message = "Your password is wrong, please try again"
             self.add_message(message, 'error')
             return self.redirect_to('edit-email')
             
     except (AttributeError,TypeError), e:
         login_error_message = _('Sorry you are not logged in!')
         self.add_message(login_error_message,'error')
         self.redirect_to('login')