 parser = new DOMParser()
-
-username = localStorage.getItem 'username'
-password = localStorage.getItem 'password'
 
 auto_online_interval = CONST.auto_online_intervals.NORMAL
 auto_online_event = CONST.status.auto_online_event_end
+
+# about token
+
+get_token = () ->
+	username = localStorage.getItem 'username', null
+	password = localStorage.getItem 'password', null
+	if not username or not password
+		set_error "no_token"
+		throw new Error("no_token")
+	return [username, password]
 
 # will convert unit to Byte
 unit_convert = (input) ->

auto_online_handle_login_status = (data) ->
	auto_online_event = CONST.status.auto_online_event_end
	if data.status == CONST.status.not_logged_in
		login_net_post username,password,auto_online_login_succ,auto_online_login_fail
	else if data.status == CONST.status.logged_in
		auto_online_set_event CONST.auto_online_intervals.NORMAL
	else if data.status == CONST.status.cant_reach_net

				failCallback && failCallback result
	)

login_net = (successCallback) ->
	login_net_post(
		successCallback
		(result) ->
			set_error result
	)
