Changeset - 52da7cba88a6
[Not reviewed]
beta
0 8 0
Marcin Kuzminski - 15 years ago 2010-11-16 08:52:31
marcin@python-works.com
Code refactor for auth func, preparing for ldap support
css updates.
turned off graph,and branches for git changelog
8 files changed with 64 insertions and 45 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/changelog.py
Show inline comments
 
@@ -74,7 +74,9 @@ class ChangelogController(BaseController
 

	
 
    def _graph(self, repo, size, p):
 
        revcount = size
 
        if not repo.revisions:return json.dumps([]), 0
 
        if not repo.revisions or repo.alias == 'git':
 
            c.jsdata = json.dumps([])
 
            return
 

	
 
        max_rev = repo.revisions[-1]
 

	
rhodecode/lib/auth.py
Show inline comments
 
@@ -73,6 +73,15 @@ def check_password(password, hashed):
 
    return bcrypt.hashpw(password, hashed) == hashed
 

	
 
def authfunc(environ, username, password):
 
    """
 
    Authentication function used in Mercurial/Git/ and access controll,
 
    firstly checks for db authentication then if ldap is enabled for ldap
 
    authentication
 
    :param environ: needed only for using in Basic auth, can be None
 
    :param username: username
 
    :param password: password
 
    """
 

	
 
    user = UserModel().get_by_username(username, cache=False)
 

	
 
    if user:
rhodecode/lib/celerylib/tasks.py
Show inline comments
 
@@ -65,7 +65,9 @@ def whoosh_index(repo_location, full_ind
 
def get_commits_stats(repo_name, ts_min_y, ts_max_y):
 
    from rhodecode.model.db import Statistics, Repository
 
    log = get_commits_stats.get_logger()
 
    author_key_cleaner = lambda k: person(k).replace('"', "") #for js data compatibilty
 

	
 
    #for js data compatibilty
 
    author_key_cleaner = lambda k: person(k).replace('"', "")
 

	
 
    commits_by_day_author_aggregate = {}
 
    commits_by_day_aggregate = {}
 
@@ -91,8 +93,8 @@ def get_commits_stats(repo_name, ts_min_
 
        return True
 

	
 
    if last_rev == repo.revisions[-1] and len(repo.revisions) > 1:
 
        #pass silently without any work if we're not on first revision or current
 
        #state of parsing revision(from db marker) is the last revision
 
        #pass silently without any work if we're not on first revision or 
 
        #current state of parsing revision(from db marker) is the last revision
 
        return True
 

	
 
    if cur_stats:
rhodecode/model/forms.py
Show inline comments
 
@@ -24,7 +24,7 @@ from formencode.validators import Unicod
 
    Email, Bool, StringBoolean
 
from pylons import session
 
from pylons.i18n.translation import _
 
from rhodecode.lib.auth import check_password, get_crypt_password
 
from rhodecode.lib.auth import authfunc, get_crypt_password
 
from rhodecode.model import meta
 
from rhodecode.model.user import UserModel
 
from rhodecode.model.repo import RepoModel
 
@@ -94,26 +94,21 @@ class ValidAuth(formencode.validators.Fa
 
        password = value['password']
 
        username = value['username']
 
        user = UserModel().get_by_username(username)
 
        if user is None:
 
            raise formencode.Invalid(self.message('invalid_password',
 
                                     state=State_obj), value, state,
 
                                     error_dict=self.e_dict)
 
        if user:
 
            if user.active:
 
                if user.username == username and check_password(password,
 
                                                                user.password):
 

	
 
        if authfunc(None, username, password):
 
                    return value
 
                else:
 
            if user and user.active is False:
 
                log.warning('user %s is disabled', username)
 
                raise formencode.Invalid(self.message('disabled_account',
 
                                         state=State_obj),
 
                                         value, state,
 
                                         error_dict=self.e_dict_disable)
 
            else:
 
                    log.warning('user %s not authenticated', username)
 
                    raise formencode.Invalid(self.message('invalid_password',
 
                                             state=State_obj), value, state,
 
                                             error_dict=self.e_dict)
 
            else:
 
                log.warning('user %s is disabled', username)
 
                raise formencode.Invalid(self.message('disabled_account',
 
                                         state=State_obj),
 
                                         value, state,
 
                                         error_dict=self.e_dict_disable)
 

	
 
class ValidRepoUser(formencode.validators.FancyValidator):
 

	
rhodecode/public/css/style.css
Show inline comments
 
@@ -825,16 +825,8 @@ font-weight:700;
 
#content div.box div.form div.fields div.field div.input {
 
margin:0 0 0 200px;
 
}
 
 
#content div.box-left div.form div.fields div.field div.input,#content div.box-right div.form div.fields div.field div.input {
 
clear:both;
 
overflow:hidden;
 
border-top:1px solid #b3b3b3;
 
border-left:1px solid #b3b3b3;
 
border-right:1px solid #eaeaea;
 
border-bottom:1px solid #eaeaea;
 
margin:0;
 
padding:7px 7px 6px;
 
margin:0 0 0 0px;
 
}
 
 
#content div.box div.form div.fields div.field div.input input {
 
@@ -850,11 +842,7 @@ margin:0;
 
padding:7px 7px 6px;
 
}
 
 
#content div.box-left div.form div.fields div.field div.input input,#content div.box-right div.form div.fields div.field div.input input {
 
width:100%;
 
border:none;
 
padding:0;
 
}
 
 
 
#content div.box div.form div.fields div.field div.input input.small {
 
width:30%;
 
@@ -2066,10 +2054,6 @@ margin:0;
 
padding:0;
 
}
 
 
#content div.box div.form div.fields div.field div.label-checkbox,#content div.box div.form div.fields div.field div.label-radio,#content div.box div.form div.fields div.field div.label-textarea {
 
padding:0 0 0 5px !important;
 
}
 
 
#content div.box div.form div.fields div.field div.label span,#login div.form div.fields div.field div.label span,#register div.form div.fields div.field div.label span {
 
height:1%;
 
display:block;
 
@@ -2098,11 +2082,17 @@ border-bottom:1px solid #c6d880;
 
margin:0;
 
}
 
 
#content div.box-left div.form div.fields div.field div.select,#content div.box-left div.form div.fields div.field div.checkboxes,#content div.box-left div.form div.fields div.field div.radios,#content div.box-right div.form div.fields div.field div.select,#content div.box-right div.form div.fields div.field div.checkboxes,#content div.box-right div.form div.fields div.field div.radios{
 
margin:0 0 0 0px !important;
 
padding:0;
 
}
 
 
#content div.box div.form div.fields div.field div.select,#content div.box div.form div.fields div.field div.checkboxes,#content div.box div.form div.fields div.field div.radios {
 
margin:0 0 0 200px;
 
padding:0;
 
}
 
 
 
#content div.box div.form div.fields div.field div.select a:hover,#content div.box div.form div.fields div.field div.select a.ui-selectmenu:hover,#content div.box div.action a:hover {
 
color:#000;
 
text-decoration:none;
rhodecode/templates/admin/repos/repo_edit.html
Show inline comments
 
@@ -18,7 +18,7 @@
 
</%def>
 

	
 
<%def name="main()">
 
<div class="box">
 
<div class="box box-left">
 
    <!-- box / title -->
 
    <div class="title">
 
        ${self.breadcrumbs()}      
 
@@ -32,7 +32,7 @@
 
                    <label for="repo_name">${_('Name')}:</label>
 
                </div>
 
                <div class="input input-medium">
 
                    ${h.text('repo_name',class_="small")}
 
                    ${h.text('repo_name',class_="medium")}
 
                </div>
 
             </div>
 
            <div class="field">
 
@@ -40,7 +40,7 @@
 
                    <label for="repo_type">${_('Type')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.select('repo_type','hg',c.backends,class_="small")}
 
                    ${h.select('repo_type','hg',c.backends,class_="medium")}
 
                </div>
 
             </div>             
 
            <div class="field">
 
@@ -280,4 +280,23 @@
 
        </script>      
 

	
 
</div>
 

	
 
<div class="box box-right">
 
    <div class="title">
 
        <h5>${_('Administration')}</h5>    
 
    </div>
 
    
 
    <div class="form">
 
    
 
        <h3>${_('Reset statistics')}</h3>
 
        <h3>${_('Reset cache')}</h3>
 
        <h3>${_('Delete')}</h3>
 
        
 
        
 
    
 
    </div>
 
    
 
</div>
 

	
 

	
 
</%def> 
 
\ No newline at end of file
rhodecode/templates/admin/users/user_edit_my_account.html
Show inline comments
 
@@ -30,7 +30,7 @@
 
	                    <label for="username">${_('Username')}:</label>
 
	                </div>
 
	                <div class="input">
 
	                    ${h.text('username')}
 
	                    ${h.text('username',class_="medium")}
 
	                </div>
 
	             </div>
 
	            
 
@@ -39,7 +39,7 @@
 
	                    <label for="new_password">${_('New password')}:</label>
 
	                </div>
 
	                <div class="input">
 
	                    ${h.password('new_password')}
 
	                    ${h.password('new_password',class_="medium")}
 
	                </div>
 
	             </div>
 
	            
 
@@ -48,7 +48,7 @@
 
	                    <label for="name">${_('First Name')}:</label>
 
	                </div>
 
	                <div class="input">
 
	                    ${h.text('name')}
 
	                    ${h.text('name',class_="medium")}
 
	                </div>
 
	             </div>
 
	            
 
@@ -57,7 +57,7 @@
 
	                    <label for="lastname">${_('Last Name')}:</label>
 
	                </div>
 
	                <div class="input">
 
	                    ${h.text('lastname')}
 
	                    ${h.text('lastname',class_="medium")}
 
	                </div>
 
	             </div>
 
	            
 
@@ -66,7 +66,7 @@
 
	                    <label for="email">${_('Email')}:</label>
 
	                </div>
 
	                <div class="input">
 
	                    ${h.text('email')}
 
	                    ${h.text('email',class_="medium")}
 
	                </div>
 
	             </div>
 
	            
rhodecode/templates/changelog/changelog.html
Show inline comments
 
@@ -78,8 +78,10 @@ ${c.repo_name} ${_('Changelog')} - ${c.r
 
                                   %endif  
 
                    									
 
								<span class="logtags">
 
									%if cs.branch:
 
									<span class="branchtag" title="${'%s %s' % (_('branch'),cs.branch)}">
 
									${h.link_to(cs.branch,h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span>
 
									%endif
 
									%for tag in cs.tags:
 
										<span class="tagtag"  title="${'%s %s' % (_('tag'),tag)}">
 
										${h.link_to(tag,h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span>
0 comments (0 inline, 0 general)