from flask import session, request, redirect, url_for, flash

#from functools import wraps

# def login_required( f ):
# 	@wraps( f )
# 	def decorated_function( *args, **kwargs ):
# 		#return 'dec'
# 		if not( 'email' in session ):
# 			#flash( 'Restricted access, please log in first' )
# 			return redirect( url_for( 'loginForm', next = request.url ) )
# 		return f( *args, **kwargs )
# 	return decorated_function


def isLoggedIn():
	return ( 'user_id' in session )


def redirectLogin( restrict ):
	if( restrict ):
		flash( 'Restricted access, please login to proceed' )
	return redirect( url_for( 'loginForm' ) )

