예제 #1
0
파일: auth.py 프로젝트: BitMistDev/frappe
	def __init__(self):
		# Get Environment variables
		self.domain = frappe.request.host
		if self.domain and self.domain.startswith('www.'):
			self.domain = self.domain[4:]

		# language
		self.set_lang(frappe.get_request_header('HTTP_ACCEPT_LANGUAGE'))

		# load cookies
		frappe.local.cookie_manager = CookieManager()

		# override request method. All request to be of type POST, but if _type == "POST" then commit
		if frappe.form_dict.get("_type"):
			frappe.local.request_method = frappe.form_dict.get("_type")
			del frappe.form_dict["_type"]

		# set db
		self.connect()

		# login
		frappe.local.login_manager = LoginManager()

		# write out latest cookies
		frappe.local.cookie_manager.init_cookies()

		# check status
		check_session_stopped()

		# load user
		self.setup_user()

		# run login triggers
		if frappe.form_dict.get('cmd')=='login':
			frappe.local.login_manager.run_trigger('on_session_creation')
예제 #2
0
    def __init__(self):
        # Get Environment variables
        self.domain = frappe.request.host
        if self.domain and self.domain.startswith('www.'):
            self.domain = self.domain[4:]

        # language
        self.set_lang(frappe.get_request_header('HTTP_ACCEPT_LANGUAGE'))

        # load cookies
        frappe.local.cookie_manager = CookieManager()

        # override request method. All request to be of type POST, but if _type == "POST" then commit
        if frappe.form_dict.get("_type"):
            frappe.local.request_method = frappe.form_dict.get("_type")
            del frappe.form_dict["_type"]

        # set db
        self.connect()

        # login
        frappe.local.login_manager = LoginManager()

        # write out latest cookies
        frappe.local.cookie_manager.init_cookies()

        # check status
        check_session_stopped()

        # load user
        self.setup_user()

        # run login triggers
        if frappe.form_dict.get('cmd') == 'login':
            frappe.local.login_manager.run_trigger('on_session_creation')
예제 #3
0
파일: auth.py 프로젝트: sbkolate/jacfrappe
    def __init__(self):
        # Get Environment variables
        self.domain = frappe.request.host
        if self.domain and self.domain.startswith('www.'):
            self.domain = self.domain[4:]

        if frappe.get_request_header('X-Forwarded-For'):
            frappe.local.request_ip = (frappe.get_request_header(
                'X-Forwarded-For').split(",")[0]).strip()

        elif frappe.get_request_header('REMOTE_ADDR'):
            frappe.local.request_ip = frappe.get_request_header('REMOTE_ADDR')

        else:
            frappe.local.request_ip = '127.0.0.1'

        # language
        self.set_lang()

        # load cookies
        frappe.local.cookie_manager = CookieManager()

        # set db
        self.connect()

        # login
        frappe.local.login_manager = LoginManager()

        if frappe.form_dict._lang:
            lang = get_lang_code(frappe.form_dict._lang)
            if lang:
                frappe.local.lang = lang

        self.validate_csrf_token()

        # write out latest cookies
        frappe.local.cookie_manager.init_cookies()

        # check status
        check_session_stopped()

        # run login triggers
        if frappe.form_dict.get('cmd') == 'login':
            frappe.local.login_manager.run_trigger('on_session_creation')
예제 #4
0
파일: auth.py 프로젝트: mbauskar/frappe
	def __init__(self):
		# Get Environment variables
		self.domain = frappe.request.host
		if self.domain and self.domain.startswith('www.'):
			self.domain = self.domain[4:]

		if frappe.get_request_header('X-Forwarded-For'):
			frappe.local.request_ip = (frappe.get_request_header('X-Forwarded-For').split(",")[0]).strip()

		elif frappe.get_request_header('REMOTE_ADDR'):
			frappe.local.request_ip = frappe.get_request_header('REMOTE_ADDR')

		else:
			frappe.local.request_ip = '127.0.0.1'

		# language
		self.set_lang()

		# load cookies
		frappe.local.cookie_manager = CookieManager()

		# set db
		self.connect()

		# login
		frappe.local.login_manager = LoginManager()

		if frappe.form_dict._lang:
			lang = get_lang_code(frappe.form_dict._lang)
			if lang:
				frappe.local.lang = lang

		self.validate_csrf_token()

		# write out latest cookies
		frappe.local.cookie_manager.init_cookies()

		# check status
		check_session_stopped()

		# run login triggers
		if frappe.form_dict.get('cmd')=='login':
			frappe.local.login_manager.run_trigger('on_session_creation')
예제 #5
0
파일: auth.py 프로젝트: emakis00/frappe
    def __init__(self):
        # Get Environment variables
        self.domain = frappe.request.host
        if self.domain and self.domain.startswith('www.'):
            self.domain = self.domain[4:]

        if frappe.get_request_header('X-Forwarded-For'):
            frappe.local.request_ip = frappe.get_request_header(
                'X-Forwarded-For')

        elif frappe.get_request_header('REMOTE_ADDR'):
            frappe.local.request_ip = frappe.get_request_header('REMOTE_ADDR')

        else:
            frappe.local.request_ip = '127.0.0.1'

        # language
        self.set_lang(frappe.request.accept_languages.values())

        # load cookies
        frappe.local.cookie_manager = CookieManager()

        # override request method. All request to be of type POST, but if _type == "POST" then commit
        if frappe.form_dict.get("_type"):
            frappe.local.request_method = frappe.form_dict.get("_type")
            del frappe.form_dict["_type"]

        # set db
        self.connect()

        # login
        frappe.local.login_manager = LoginManager()

        # write out latest cookies
        frappe.local.cookie_manager.init_cookies()

        # check status
        check_session_stopped()

        # run login triggers
        if frappe.form_dict.get('cmd') == 'login':
            frappe.local.login_manager.run_trigger('on_session_creation')
예제 #6
0
파일: auth.py 프로젝트: Alphamonarch/frappe
	def __init__(self):
		# Get Environment variables
		self.domain = frappe.request.host
		if self.domain and self.domain.startswith('www.'):
			self.domain = self.domain[4:]

		if frappe.get_request_header('X-Forwarded-For'):
			frappe.local.request_ip = frappe.get_request_header('X-Forwarded-For')

		elif frappe.get_request_header('REMOTE_ADDR'):
			frappe.local.request_ip = frappe.get_request_header('REMOTE_ADDR')

		else:
			frappe.local.request_ip = '127.0.0.1'

		# language
		self.set_lang(frappe.request.accept_languages.values())

		# load cookies
		frappe.local.cookie_manager = CookieManager()

		# override request method. All request to be of type POST, but if _type == "POST" then commit
		if frappe.form_dict.get("_type"):
			frappe.local.request_method = frappe.form_dict.get("_type")
			del frappe.form_dict["_type"]

		# set db
		self.connect()

		# login
		frappe.local.login_manager = LoginManager()

		# write out latest cookies
		frappe.local.cookie_manager.init_cookies()

		# check status
		check_session_stopped()

		# run login triggers
		if frappe.form_dict.get('cmd')=='login':
			frappe.local.login_manager.run_trigger('on_session_creation')
			self.clear_active_sessions()
예제 #7
0
파일: auth.py 프로젝트: erpnext-tm/frappe
    def __init__(self):
        # set frappe.local.request_ip
        self.set_request_ip()

        # load cookies
        self.set_cookies()

        # set frappe.local.db
        self.connect()

        # login and start/resume user session
        self.set_session()

        # set request language
        self.set_lang()

        # match csrf token from current session
        self.validate_csrf_token()

        # write out latest cookies
        frappe.local.cookie_manager.init_cookies()

        # check session status
        check_session_stopped()