class Welcome
Public Instance Methods
direct_connect(session)
click to toggle source
# File Views/Welcome.rb, line 79 def direct_connect(session) if !session or !session.owner return reply(:window_show, :login_failed) + reply(:update, :reason => 'Please enter a valid login') end if View.SelfInternet.can_connect(session) == 0 dputs(2) { "Auto-connecting #{session.owner.login_name}" } View.SelfInternet.rpc_button_connect(session, nil) end tabs = View.list(session)._views dputs(3) { "Tabs starts as #{tabs.inspect}" } selftabs = tabs.find { |v| v.first == 'SelfTabs' } tabs.delete_if { |v| v.first == 'SelfTabs' } if selftabs tabs.unshift selftabs end dputs(3) { "Tabs is now #{tabs.inspect}" } return reply(:session_id, session.sid) + reply(:list, views: tabs) + (session.s_data._sub_tabs_only ? View.reply(:bar_position, 'top') : []) end
dummy_for_translation()
click to toggle source
# File Views/Welcome.rb, line 2 def dummy_for_translation show_str :username show_str :version show_str :direct_connect show_str :simple_connect end
rpc_show(session)
click to toggle source
Overwrite the standard rpc_show
to speed up testing…
Calls superclass method
# File Views/Welcome.rb, line 10 def rpc_show(session) # GC.start web_req = session.web_req client_ip = RPCQooxdooHandler.get_ip(web_req) person = if get_config(false, :autologin) Entities.Persons.match_by_login_name(get_config(false, :autologin)) else nil end if person person and dputs(3) { "Found login #{person.data.inspect}" } session = get_config(false, :multilogin) ? Sessions.find_by_owner(person.person_id) : nil session ||= Sessions.create(person) dputs(3) { "Session is #{session.inspect}" } return reply(:session_id, person.session_id) + View.rpc_list(session) else if session.web_req && ref = session.web_req.header._referer user, pass = ref.first.match(/user=(.*)&pass=(.*)/).to_a[1..2] if user && pass return rpc_button_direct_connect(session, {username: user, password: pass}) end end Sessions.search_by_owner('[0-9]').each { |s| if s.last_seen && Time.now.to_i - s.last_seen.to_i <= 15 log_msg :Welcome, "Found session #{s.inspect} from ip #{s.client_ip}" if s.client_ip == client_ip log_msg :Welcome, "Found session #{s.inspect} with correct ip" #dp person = session.owner #session = Sessions.create( person ) return direct_connect(s) end end } super + reply(:update, :version => VERSION_GESTION) + reply(:update, :links => ConfigBase.welcome_text) + reply_visible(ConfigBase.has_function?(:internet_captive), :direct_connect) end end