コード例 #1
0
ファイル: api.py プロジェクト: jun66j5/accountmanagerplugin
 def _create_user(self, req):
     """Set password and prime a new authenticated Trac session."""
     email = req.args.get('email', '').strip()
     name = req.args.get('name', '').strip()
     username = self.handle_username_casing(
         req.args.get('username', '').strip())
     # Result of a successful account creation request is a made-up
     # authenticated session, that a new user can refer to later on.
     # Strictly required to create a primary key for additional attributes,
     # perhaps even something as critical as the SessionStore password.
     from acct_mgr.model import prime_auth_session, set_user_attribute
     try:
         prime_auth_session(self.env, username)
         # Save attributes for the user with reference to that session ID.
         # Done before writing to a password store to preserve attributes
         # in case of non-fatal errors (especially notification errors).
         for attribute in ('name', 'email'):
             value = req.args.get(attribute)
             if not value:
                 continue
         set_user_attribute(self.env, username, attribute, value)
         # Create the user in the configured (primary) password store.
         self.set_password(username,
                           req.args.get('password'),
                           overwrite=False)
     finally:
         if not self.has_user(username):
             # Rollback.
             from acct_mgr.model import delete_user
             delete_user(self.env, username)
コード例 #2
0
 def _create_user(self, req):
     """Set password and prime a new authenticated Trac session."""
     username = req.args.get('username', '').strip()
     username = self.handle_username_casing(username)
     # Result of a successful account creation request is a made-up
     # authenticated session, that a new user can refer to later on.
     # Strictly required to create a primary key for additional attributes,
     # perhaps even something as critical as the SessionStore password.
     from acct_mgr.model import prime_auth_session, set_user_attribute
     try:
         prime_auth_session(self.env, username)
         # Save attributes for the user with reference to that session ID.
         # Done before writing to a password store to preserve attributes
         # in case of non-fatal errors (especially notification errors).
         for attribute in ('name', 'email'):
             value = req.args.get(attribute)
             if not value:
                 continue
             set_user_attribute(self.env, username, attribute, value)
         # Create the user in the configured (primary) password store.
         self.set_password(username, req.args.get('password'),
                           overwrite=False)
     finally:
         if not self.has_user(username):
             # Rollback.
             from acct_mgr.model import delete_user
             delete_user(self.env, username)
コード例 #3
0
ファイル: api.py プロジェクト: pombredanne/trachacks
 def _create_user(self, req):
     """Set password and prime a new authenticated Trac session."""
     email = req.args.get('email', '').strip()
     name = req.args.get('name', '').strip()
     username = self.handle_username_casing(
         req.args.get('username', '').strip())
     # Create the user in the configured (primary) password store.
     if self.set_password(username, req.args.get('password'), None, False):
         # Result of a successful account creation request is a made-up
         # authenticated session, that a new user can refer to later on.
         from acct_mgr.model import prime_auth_session, set_user_attribute
         prime_auth_session(self.env, username)
         # Save attributes for the user with reference to that session ID.
         for attribute in ('name', 'email'):
             value = req.args.get(attribute)
             if not value:
                 continue
             set_user_attribute(self.env, username, attribute, value)
コード例 #4
0
ファイル: api.py プロジェクト: lkraav/trachacks
 def _create_user(self, req):
     """Set password and prime a new authenticated Trac session."""
     email = req.args.get('email', '').strip()
     name = req.args.get('name', '').strip()
     username = self.handle_username_casing(
                    req.args.get('username', '').strip())
     # Create the user in the configured (primary) password store.
     if self.set_password(username, req.args.get('password'), None, False):
         # Result of a successful account creation request is a made-up
         # authenticated session, that a new user can refer to later on.
         from acct_mgr.model import prime_auth_session, set_user_attribute
         prime_auth_session(self.env, username)
         # Save attributes for the user with reference to that session ID.
         for attribute in ('name', 'email'):
             value = req.args.get(attribute)
             if not value:
                 continue
             set_user_attribute(self.env, username, attribute, value)
コード例 #5
0
    def validate_registration(self, req):
        """Run configured registration checks and prime account on success."""
        for inspector in self._register_check:
            inspector.validate_registration(req)

        username = self.handle_username_casing(
            req.args.get('username').strip())
        name = req.args.get('name').strip()
        email = req.args.get('email').strip()
        # Create the user in the configured (primary) password store.
        self.set_password(username, req.args.get('password'))
        # Output of a successful account creation request is a made-up
        # authenticated session, that a new user can refer to later on.
        prime_auth_session(self.env, username)
        # Save attributes for the user with reference to that session ID.
        for attribute in ('name', 'email'):
            value = req.args.get(attribute)
            if not value:
                continue
            set_user_attribute(self.env, username, attribute, value)
コード例 #6
0
ファイル: api.py プロジェクト: lkraav/trachacks
    def validate_registration(self, req):
        """Run configured registration checks and prime account on success."""
        for inspector in self._register_check:
            inspector.validate_registration(req)

        username = self.handle_username_casing(
            req.args.get('username').strip())
        name = req.args.get('name').strip()
        email = req.args.get('email').strip()
        # Create the user in the configured (primary) password store.
        self.set_password(username, req.args.get('password'))
        # Output of a successful account creation request is a made-up
        # authenticated session, that a new user can refer to later on.
        prime_auth_session(self.env, username)
        # Save attributes for the user with reference to that session ID.
        for attribute in ('name', 'email'):
            value = req.args.get(attribute)
            if not value:
                continue
            set_user_attribute(self.env, username, attribute, value)