예제 #1
0
 def validate_username(self, value):
     value = validator.validate_identifier(value)
     # check that this user name does not exist
     u = usermanager.UserManager.get_by_username(value)
     if u:
         raise ValueError(_("Username %s is not available. Please choose another one.")
                          % value)
     return value
예제 #2
0
    def validate_username(self, value):
        value = validator.validate_identifier(value)

        user = self._get_user_by_username(value)
        if not user:
            raise ValueError(
                _("This username is not registered on our database"))
        if user.source != 'application':
            raise ValueError(
                _("You can not change your password since you log in by an external service."))
        return value
예제 #3
0
    def validate_username(self, value):
        """Check username

        In:
         - ``value`` -- username (must be unique)
        Return:
         - username value if username is unique (else raise an exception)
        """
        value = validator.validate_identifier(value)
        # check that this user name does not exist
        user = self.user_manager.get_by_username(value)
        if user:
            raise ValueError(_('Username %s is not available. Please choose another one.')
                             % value)
        return value
예제 #4
0
    def validate_username(self, value):
        """Check username

        In:
         - ``value`` -- username (must be unique)
        Return:
         - username value if username is unique (else raise an exception)
        """
        value = validator.validate_identifier(value)
        # check that this user name does not exist
        user = self.user_manager.get_by_username(value)
        if user:
            raise ValueError(_('Username %s is not available. Please choose another one.')
                             % value)
        return value