Changeset - 88338675a0f7
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 15 years ago 2010-11-24 03:31:33
marcin@python-works.com
fixed ldap issue and small template fix
2 files changed with 5 insertions and 5 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/auth.py
Show inline comments
 
@@ -88,59 +88,59 @@ def authfunc(environ, username, password
 
    user_model = UserModel()
 
    user = user_model.get_by_username(username, cache=False)
 

	
 
    if user is not None and user.is_ldap is False:
 
        if user.active:
 

	
 
            if user.username == 'default' and user.active:
 
                log.info('user %s authenticated correctly', username)
 
                return True
 

	
 
            elif user.username == username and check_password(password, user.password):
 
                log.info('user %s authenticated correctly', username)
 
                return True
 
        else:
 
            log.error('user %s is disabled', username)
 

	
 

	
 
    else:
 

	
 
        #since ldap is searching in case insensitive check if this user is still
 
        #not in our system
 
        username = username.lower()
 
        user_obj = user_model.get_by_username(username, cache=False,
 
                                            case_insensitive=True)
 
        if user_obj is not None:
 
            return False 
 
        
 
        if user_obj is not None and user_obj.is_ldap is False:
 
            return False
 

	
 
        from rhodecode.model.settings import SettingsModel
 
        ldap_settings = SettingsModel().get_ldap_settings()
 

	
 
        #======================================================================
 
        # FALLBACK TO LDAP AUTH IN ENABLE                
 
        #======================================================================
 
        if ldap_settings.get('ldap_active', False):
 
            
 

	
 
            kwargs = {
 
                  'server':ldap_settings.get('ldap_host', ''),
 
                  'base_dn':ldap_settings.get('ldap_base_dn', ''),
 
                  'port':ldap_settings.get('ldap_port'),
 
                  'bind_dn':ldap_settings.get('ldap_dn_user'),
 
                  'bind_pass':ldap_settings.get('ldap_dn_pass'),
 
                  'use_ldaps':ldap_settings.get('ldap_ldaps'),
 
                  'ldap_version':3,
 
                  }
 
            log.debug('Checking for ldap authentication')
 
            try:
 
                aldap = AuthLdap(**kwargs)
 
                res = aldap.authenticate_ldap(username, password)
 

	
 
                authenticated = res[1]['uid'][0] == username
 

	
 
                if authenticated and user_model.create_ldap(username, password):
 
                    log.info('created new ldap user')
 

	
 
                return authenticated
 
            except (LdapUsernameError, LdapPasswordError):
 
                return False
 
            except:
 
                log.error(traceback.format_exc())
rhodecode/public/css/style.css
Show inline comments
 
@@ -2296,49 +2296,49 @@ display:block;
 
float:left;
 
margin:0 0 0 3px;
 
padding:0;
 
}
 
 
#login div.title h5,#register div.title h5 {
 
color:#fff;
 
margin:10px;
 
padding:0;
 
}
 
 
#login div.form div.fields div.field,#register div.form div.fields div.field {
 
clear:both;
 
overflow:hidden;
 
margin:0;
 
padding:0 0 10px;
 
}
 
 
#login div.form div.fields div.field span.error-message,#register div.form div.fields div.field span.error-message {
 
height:1%;
 
display:block;
 
color:red;
 
margin:8px 0 0;
 
padding:0;
 
width: 320px;
 
max-width: 320px;
 
}
 
 
#login div.form div.fields div.field div.label label,#register div.form div.fields div.field div.label label {
 
color:#000;
 
font-weight:700;
 
}
 
 
#login div.form div.fields div.field div.input,#register div.form div.fields div.field div.input {
 
float:left;
 
margin:0;
 
padding:0;
 
}
 
 
#login div.form div.fields div.field div.checkbox,#register div.form div.fields div.field div.checkbox {
 
margin:0 0 0 184px;
 
padding:0;
 
}
 
 
#login div.form div.fields div.field div.checkbox label,#register div.form div.fields div.field div.checkbox label {
 
color:#565656;
 
font-weight:700;
 
}
 
 
#login div.form div.fields div.buttons input,#register div.form div.fields div.buttons input {
0 comments (0 inline, 0 general)