def decorated_function(*args, **kwargs):
		g.current_user = None
		if 'sessionid' in session: 
			g.current_user = user.getUserBySessionID(str(session['sessionid']),request.remote_addr)
		if g.current_user is not None:
			return redirect(url_for('routes_user.dashboard'))
		g.current_user = user.User()
		return f(*args, **kwargs)
	def decorated_function(*args, **kwargs):
		g.current_user = None
		if 'sessionid' in session: 
			g.current_user = user.getUserBySessionID(str(session['sessionid']),request.remote_addr)
		if g.current_user is None:
			flash('info|You need to log in to access ' + request.url)
			return redirect(url_for('routes_user.login', next=request.url))
		g.current_user.logged_in = True
		return f(*args, **kwargs)
	def decorated_function(*args,**kwargs):
		g.current_user = None
		if 'sessionid' in session: 
			g.current_user = user.getUserBySessionID(str(session['sessionid']),request.remote_addr)
		if g.current_user is None:
			g.current_user = user.User() # Set a blank user
		else:
			g.current_user.logged_in = True
		return f(*args, **kwargs)