|  | @@ -12,6 +12,8 @@ from tg import url
 | 
	
		
			
			| 12 | 12 |  
 | 
	
		
			
			| 13 | 13 |  from tg.i18n import ugettext as _
 | 
	
		
			
			| 14 | 14 |  
 | 
	
		
			
			|  | 15 | +from tracim.lib import CST
 | 
	
		
			
			|  | 16 | +from tracim.lib.base import logger
 | 
	
		
			
			| 15 | 17 |  from tracim.lib.user import UserStaticApi
 | 
	
		
			
			| 16 | 18 |  
 | 
	
		
			
			| 17 | 19 |  from tracim.controllers import StandardController
 | 
	
	
		
			
			|  | @@ -57,13 +59,17 @@ class RootController(StandardController):
 | 
	
		
			
			| 57 | 59 |  
 | 
	
		
			
			| 58 | 60 |  
 | 
	
		
			
			| 59 | 61 |      @expose('tracim.templates.index')
 | 
	
		
			
			| 60 |  | -    def index(self, came_from=lurl('/'), *args, **kwargs):
 | 
	
		
			
			|  | 62 | +    def index(self, came_from='', *args, **kwargs):
 | 
	
		
			
			| 61 | 63 |          if request.identity:
 | 
	
		
			
			| 62 |  | -            redirect(self.url(None, self.dashboard.__name__))
 | 
	
		
			
			|  | 64 | +            if came_from:
 | 
	
		
			
			|  | 65 | +                logger.info(self, 'Will redirect to {}'.format(came_from))
 | 
	
		
			
			|  | 66 | +                redirect(url(came_from))
 | 
	
		
			
			|  | 67 | +            else:
 | 
	
		
			
			|  | 68 | +                redirect(self.url(None, self.dashboard.__name__))
 | 
	
		
			
			| 63 | 69 |  
 | 
	
		
			
			| 64 | 70 |          login_counter = request.environ.get('repoze.who.logins', 0)
 | 
	
		
			
			| 65 | 71 |          if login_counter > 0:
 | 
	
		
			
			| 66 |  | -            flash(_('Wrong credentials'), 'error')
 | 
	
		
			
			|  | 72 | +            flash(_('Wrong credentials'), CST.STATUS_ERROR)
 | 
	
		
			
			| 67 | 73 |          return dict(page='login', login_counter=str(login_counter),
 | 
	
		
			
			| 68 | 74 |                      came_from=came_from)
 | 
	
		
			
			| 69 | 75 |  
 | 
	
	
		
			
			|  | @@ -78,7 +84,9 @@ class RootController(StandardController):
 | 
	
		
			
			| 78 | 84 |          :param kwargs:
 | 
	
		
			
			| 79 | 85 |          :return:
 | 
	
		
			
			| 80 | 86 |          """
 | 
	
		
			
			| 81 |  | -        return self.index(args, kwargs)
 | 
	
		
			
			|  | 87 | +        came_from = kwargs['came_from'] if 'came_from' in kwargs.keys() else ''
 | 
	
		
			
			|  | 88 | +        logger.info(self, 'came_from: {}'.format(kwargs))
 | 
	
		
			
			|  | 89 | +        return self.index(came_from, args, *kwargs)
 | 
	
		
			
			| 82 | 90 |  
 | 
	
		
			
			| 83 | 91 |  
 | 
	
		
			
			| 84 | 92 |      @expose()
 |