Changeset - 520d27f40b51
[Not reviewed]
beta
0 3 0
Marcin Kuzminski - 15 years ago 2011-02-15 23:19:01
marcin@python-works.com
#113 removed anonymous access from forking, added system messages in login box.
3 files changed with 22 insertions and 3 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/settings.py
Show inline comments
 
@@ -35,9 +35,12 @@ from pylons.controllers.util import redi
 
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 @@ class SettingsController(BaseRepoControl
 

	
 
        return redirect(url('home'))
 

	
 
    @NotAnonymous()
 
    @HasRepoPermissionAllDecorator('repository.read')
 
    def fork(self, repo_name):
 
        repo_model = RepoModel()
 
@@ -172,7 +176,7 @@ class SettingsController(BaseRepoControl
 

	
 
        return render('settings/repo_fork.html')
 

	
 

	
 
    @NotAnonymous()
 
    @HasRepoPermissionAllDecorator('repository.read')
 
    def fork_create(self, repo_name):
 
        repo_model = RepoModel()
rhodecode/lib/auth.py
Show inline comments
 
@@ -33,6 +33,7 @@ from decorator import decorator
 

	
 
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 @@ class NotAnonymous(object):
 
            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)
rhodecode/templates/login.html
Show inline comments
 
@@ -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>
0 comments (0 inline, 0 general)