# HG changeset patch # User Marcin Kuzminski # Date 1289893951 -3600 # Node ID 52da7cba88a68264a1cbeb9e8a2113f8bfb8937e # Parent 4cd0709b6d4b79f40101a1e2ecaebe79bd3145ed Code refactor for auth func, preparing for ldap support css updates. turned off graph,and branches for git changelog diff -r 4cd0709b6d4b -r 52da7cba88a6 rhodecode/controllers/changelog.py --- a/rhodecode/controllers/changelog.py Mon Nov 15 18:38:54 2010 +0100 +++ b/rhodecode/controllers/changelog.py Tue Nov 16 08:52:31 2010 +0100 @@ -74,7 +74,9 @@ 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] diff -r 4cd0709b6d4b -r 52da7cba88a6 rhodecode/lib/auth.py --- a/rhodecode/lib/auth.py Mon Nov 15 18:38:54 2010 +0100 +++ b/rhodecode/lib/auth.py Tue Nov 16 08:52:31 2010 +0100 @@ -73,6 +73,15 @@ 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: diff -r 4cd0709b6d4b -r 52da7cba88a6 rhodecode/lib/celerylib/tasks.py --- a/rhodecode/lib/celerylib/tasks.py Mon Nov 15 18:38:54 2010 +0100 +++ b/rhodecode/lib/celerylib/tasks.py Tue Nov 16 08:52:31 2010 +0100 @@ -65,7 +65,9 @@ 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 @@ 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: diff -r 4cd0709b6d4b -r 52da7cba88a6 rhodecode/model/forms.py --- a/rhodecode/model/forms.py Mon Nov 15 18:38:54 2010 +0100 +++ b/rhodecode/model/forms.py Tue Nov 16 08:52:31 2010 +0100 @@ -24,7 +24,7 @@ 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 @@ 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): - return value - 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: + + 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) class ValidRepoUser(formencode.validators.FancyValidator): diff -r 4cd0709b6d4b -r 52da7cba88a6 rhodecode/public/css/style.css --- a/rhodecode/public/css/style.css Mon Nov 15 18:38:54 2010 +0100 +++ b/rhodecode/public/css/style.css Tue Nov 16 08:52:31 2010 +0100 @@ -825,16 +825,8 @@ #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 @@ 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 @@ 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 @@ 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; diff -r 4cd0709b6d4b -r 52da7cba88a6 rhodecode/templates/admin/repos/repo_edit.html --- a/rhodecode/templates/admin/repos/repo_edit.html Mon Nov 15 18:38:54 2010 +0100 +++ b/rhodecode/templates/admin/repos/repo_edit.html Tue Nov 16 08:52:31 2010 +0100 @@ -18,7 +18,7 @@ <%def name="main()"> -
+
${self.breadcrumbs()} @@ -32,7 +32,7 @@
- ${h.text('repo_name',class_="small")} + ${h.text('repo_name',class_="medium")}
@@ -40,7 +40,7 @@
- ${h.select('repo_type','hg',c.backends,class_="small")} + ${h.select('repo_type','hg',c.backends,class_="medium")}
@@ -280,4 +280,23 @@
+ +
+
+
${_('Administration')}
+
+ +
+ +

${_('Reset statistics')}

+

${_('Reset cache')}

+

${_('Delete')}

+ + + +
+ +
+ + \ No newline at end of file diff -r 4cd0709b6d4b -r 52da7cba88a6 rhodecode/templates/admin/users/user_edit_my_account.html --- a/rhodecode/templates/admin/users/user_edit_my_account.html Mon Nov 15 18:38:54 2010 +0100 +++ b/rhodecode/templates/admin/users/user_edit_my_account.html Tue Nov 16 08:52:31 2010 +0100 @@ -30,7 +30,7 @@
- ${h.text('username')} + ${h.text('username',class_="medium")}
@@ -39,7 +39,7 @@
- ${h.password('new_password')} + ${h.password('new_password',class_="medium")}
@@ -48,7 +48,7 @@
- ${h.text('name')} + ${h.text('name',class_="medium")}
@@ -57,7 +57,7 @@
- ${h.text('lastname')} + ${h.text('lastname',class_="medium")}
@@ -66,7 +66,7 @@
- ${h.text('email')} + ${h.text('email',class_="medium")}
diff -r 4cd0709b6d4b -r 52da7cba88a6 rhodecode/templates/changelog/changelog.html --- a/rhodecode/templates/changelog/changelog.html Mon Nov 15 18:38:54 2010 +0100 +++ b/rhodecode/templates/changelog/changelog.html Tue Nov 16 08:52:31 2010 +0100 @@ -78,8 +78,10 @@ %endif + %if cs.branch: - ${h.link_to(cs.branch,h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))} + ${h.link_to(cs.branch,h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))} + %endif %for tag in cs.tags: ${h.link_to(tag,h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}