Browse code

Pri prihlasovani na jabber pouzit udaje zo session

Cinan Rakosnik authored on 13/04/2013 at 11:13:03
Showing 2 changed files
... ...
@@ -24,11 +24,14 @@ class WsRosterController < WebsocketRails::BaseController
24 24
     def connect
25 25
         initialize_storage()
26 26
 
27
-        clients = Token.fing_user_accounts_having_to_token(session[:token])
27
+        # TODO: Pouzit najprv:
28
+        # clients = Token.fing_user_accounts_having_to_token(session[:token])
29
+        # ale toto, az ked budem mat dokonceny multiaccount (settings a popup)
30
+        clients = session[:users]
28 31
 
29
-        clients.each do |credentials|
32
+        clients.each do |jid, pass|
30 33
             begin
31
-                client = Signin.try_login(credentials['jid'], credentials['pass'])
34
+                client = Signin.try_login(jid, pass)
32 35
                 connection_store[:clients] << client
33 36
             rescue Signin::LoginError
34 37
                 send_message 'app.client.cannot_connect', true
... ...
@@ -4,4 +4,11 @@
4 4
 # If you change this key, all old signed cookies will become invalid!
5 5
 # Make sure the secret is at least 30 characters and all random,
6 6
 # no regular words or you'll be exposed to dictionary attacks.
7
-Xmpp::Application.config.secret_token = '48c49768f9ec3134de5f76e352f13bf8fd66252d67f6d285c1c6de8457f0499075975aaaef1c32be9d596120302e8e3f7b6200c207835463ecdbb6c1610705c2'
7
+
8
+if Rails.env == 'development'
9
+    Xmpp::Application.config.secret_token = '48c49768f9ec3134de5f76e352f13bf8fd66258941sa5d489g4fhj8k4uk8499075975aaaef1c32be9d596120302e8e3f7b6200c207835463ecdbb6c1610705c2'
10
+elsif Rails.env == 'test'
11
+    Xmpp::Application.config.secret_token = '48c49768f9ec3134de5f76e352f13bf8fd66252d67f6d285c1c6de8457f0499075975aaaesdjfdsaf84dasf4das89f47d44hgf7yuuy35463ecdbb6c1610705c2'
12
+else
13
+    Xmpp::Application.config.secret_token = '8as5dg8fd4s5f76e352f13bf8fd66289dsa41s4tyijk8uy494j4e8457f0499075975aaaef89asd4302e8e3f7b6200c207835463ecdbb6cugsadbfy31610705c2'
14
+end