changeset 1056:520d27f40b51 beta

#113 removed anonymous access from forking, added system messages in login box.
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 15 Feb 2011 23:19:01 +0100
parents 903aadbf9047
children 97ed582ea86e
files rhodecode/controllers/settings.py rhodecode/lib/auth.py rhodecode/templates/login.html
diffstat 3 files changed, 22 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/settings.py	Tue Feb 15 23:03:33 2011 +0100
+++ b/rhodecode/controllers/settings.py	Tue Feb 15 23:19:01 2011 +0100
@@ -35,9 +35,12 @@
 from pylons.i18n.translation import _
 
 import rhodecode.lib.helpers as h
-from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAllDecorator
+
+from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAllDecorator, \
+    NotAnonymous
 from rhodecode.lib.base import BaseRepoController, render
 from rhodecode.lib.utils import invalidate_cache, action_logger
+
 from rhodecode.model.forms import RepoSettingsForm, RepoForkForm
 from rhodecode.model.repo import RepoModel
 from rhodecode.model.db import User
@@ -157,6 +160,7 @@
 
         return redirect(url('home'))
 
+    @NotAnonymous()
     @HasRepoPermissionAllDecorator('repository.read')
     def fork(self, repo_name):
         repo_model = RepoModel()
@@ -172,7 +176,7 @@
 
         return render('settings/repo_fork.html')
 
-
+    @NotAnonymous()
     @HasRepoPermissionAllDecorator('repository.read')
     def fork_create(self, repo_name):
         repo_model = RepoModel()
--- a/rhodecode/lib/auth.py	Tue Feb 15 23:03:33 2011 +0100
+++ b/rhodecode/lib/auth.py	Tue Feb 15 23:19:01 2011 +0100
@@ -33,6 +33,7 @@
 
 from pylons import config, session, url, request
 from pylons.controllers.util import abort, redirect
+from pylons.i18n.translation import _
 
 from rhodecode.lib.exceptions import LdapPasswordError, LdapUsernameError
 from rhodecode.lib.utils import get_repo_slug
@@ -384,6 +385,10 @@
             p += request.environ.get('PATH_INFO')
             if request.environ.get('QUERY_STRING'):
                 p += '?' + request.environ.get('QUERY_STRING')
+
+            import rhodecode.lib.helpers as h
+            h.flash(_('You need to be a registered user to perform this action'),
+                    category='warning')
             return redirect(url('login_home', came_from=p))
         else:
             return func(*fargs, **fkwargs)
--- a/rhodecode/templates/login.html	Tue Feb 15 23:03:33 2011 +0100
+++ b/rhodecode/templates/login.html	Tue Feb 15 23:19:01 2011 +0100
@@ -12,7 +12,17 @@
 
     </head>
     <body>
-<div id="login">
+        <div id="login">
+        <div class="flash_msg">
+            <% messages = h.flash.pop_messages() %>
+            % if messages:
+            <ul id="flash-messages">
+                % for message in messages:
+                <li class="${message.category}_msg">${message}</li>
+                % endfor
+            </ul>
+            % endif
+        </div>          
             <!-- login -->
             <div class="title top-left-rounded-corner top-right-rounded-corner">
                 <h5>${_('Sign In to')} ${c.rhodecode_name}</h5>