示例#1
0
    def authenticate(self, req):
        if req.incookie.has_key('trac_auth'):
            #Try to authenticate in the master environment
            self.log.debug("Trying to authenticate in master environment")
            env = get_master_env(self.env)
            return auth.LoginModule(env).authenticate(req)

        return None
示例#2
0
 def _enable_check(self, log=False):
     writable = AccountManager(self.env).supports('set_password')
     ignore_case = auth.LoginModule(self.env).ignore_case
     if log:
         if not writable:
             self.log.warn('RegistrationModule is disabled because the '
                           'password store does not support writing.')
         if ignore_case:
             self.log.warn('RegistrationModule is disabled because '
                           'ignore_auth_case is enabled in trac.ini.  '
                           'This setting needs disabled to support '
                           'registration.')
     return writable and not ignore_case
示例#3
0
 def _enable_check(self, log=False):
     env = self.env
     writable = self.acctmgr.supports('set_password')
     ignore_case = auth.LoginModule(env).ignore_case
     if log:
         if not writable:
             self.log.warn('RegistrationModule is disabled because the '
                           'password store does not support writing.')
         if ignore_case:
             self.log.debug('RegistrationModule will allow lowercase '
                            'usernames only and convert them forcefully '
                            'as required, while \'ignore_auth_case\' is '
                            'enabled in [trac] section of your trac.ini.')
     return is_enabled(env, self.__class__) and writable
示例#4
0
def _shared_do_login(original_callable, the_class, req, *args, **kwargs):

    #Call the original _do_login
    original_callable(the_class, req, *args, **kwargs)

    child_env = the_class.env
    env = get_master_env(child_env)
    if env.path != child_env.path:
        #Instantiate a trac LoginModule using the master environment, and login on it
        auth.LoginModule(env)._do_login(req)

    auth_path = child_env.config.get('projectmanager', 'auth_cookie_path', '/')
    child_env.log.debug("Changing auth cookie path to %s" % auth_path)
    req.outcookie['trac_auth']['path'] = auth_path