changeset 674:99875a8f2ad1 beta

#49 Enabled anonymous access push and pull commands
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 11 Nov 2010 01:21:33 +0100
parents dd532af216d9
children 59670f091c76
files rhodecode/controllers/summary.py rhodecode/lib/auth.py rhodecode/lib/middleware/simplehg.py
diffstat 3 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/summary.py	Thu Nov 11 01:05:43 2010 +0100
+++ b/rhodecode/controllers/summary.py	Thu Nov 11 01:21:33 2010 +0100
@@ -62,9 +62,15 @@
 
         e = request.environ
 
-        uri = u'%(protocol)s://%(user)s@%(host)s%(prefix)s/%(repo_name)s' % {
+        if self.rhodecode_user.username == 'default':
+            password = ':default'
+        else:
+            password = ''
+
+        uri = u'%(protocol)s://%(user)s%(password)s@%(host)s%(prefix)s/%(repo_name)s' % {
                                         'protocol': e.get('wsgi.url_scheme'),
                                         'user':str(c.rhodecode_user.username),
+                                        'password':password,
                                         'host':e.get('HTTP_HOST'),
                                         'prefix':e.get('SCRIPT_NAME'),
                                         'repo_name':c.repo_name, }
--- a/rhodecode/lib/auth.py	Thu Nov 11 01:05:43 2010 +0100
+++ b/rhodecode/lib/auth.py	Thu Nov 11 01:21:33 2010 +0100
@@ -77,7 +77,12 @@
 
     if user:
         if user.active:
-            if user.username == username and check_password(password, user.password):
+
+            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:
--- a/rhodecode/lib/middleware/simplehg.py	Thu Nov 11 01:05:43 2010 +0100
+++ b/rhodecode/lib/middleware/simplehg.py	Thu Nov 11 01:21:33 2010 +0100
@@ -46,7 +46,7 @@
     def __init__(self, application, config):
         self.application = application
         self.config = config
-        #authenticate this mercurial request using 
+        #authenticate this mercurial request using authfunc
         self.authenticate = AuthBasicAuthenticator('', authfunc)
         self.ipaddr = '0.0.0.0'
         self.repository = None