web_socket_chat_server 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHAT_CLIENT_EXAMPLE/chatapp.html +2 -2
- data/lib/web_socket_chat_server/version.rb +1 -1
- data/lib/web_socket_chat_server.rb +17 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1eaef39c1692af8b3d3abe96c5a30a1fe8862fea
|
4
|
+
data.tar.gz: a06f9c5102984f25c0384b0fe16a7fd6781b2dd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 512396a5563d14b6d956d66cea89b53e6f9f8ce55447afdc596cdde336082aedbcb60d43a3c58ffad91c677a267d8fff002276d1a83b926b513b32a288401e34
|
7
|
+
data.tar.gz: 71165fbef526906a5317c15562defda07afe38adb263daeba061c4b109fb6f2e362aa53004a109b96f077a0a0964ac940f9cb505d3b43505b4f20165544ac9c5
|
@@ -18,8 +18,8 @@
|
|
18
18
|
<input type="text" class="form-control" id="username" placeholder="username">
|
19
19
|
</div>
|
20
20
|
<div class="form-group">
|
21
|
-
<label for="password">
|
22
|
-
<input type="password" class="form-control" id="password" placeholder="
|
21
|
+
<label for="password">Password</label>
|
22
|
+
<input type="password" class="form-control" id="password" placeholder="">
|
23
23
|
</div>
|
24
24
|
<button type="submit" class="btn btn-primary">Login</button>
|
25
25
|
</form>
|
@@ -136,14 +136,6 @@ end
|
|
136
136
|
break
|
137
137
|
end
|
138
138
|
|
139
|
-
if admin_credentials_invalid?(username, password)
|
140
|
-
response = create_response_json("failed_connection", nil, "Invalid credentials.")
|
141
|
-
yield response if block_given?
|
142
|
-
ws.send(response)
|
143
|
-
ws.close
|
144
|
-
break
|
145
|
-
end
|
146
|
-
|
147
139
|
if user_credentials_valid?(username, password) == false
|
148
140
|
response = create_response_json("failed_connection", nil, "Invalid user creadentials. The username has to be at least 3 alphanumeric characters, and the password at least 6 alphanumeric characters.")
|
149
141
|
yield response if block_given?
|
@@ -160,12 +152,27 @@ end
|
|
160
152
|
break
|
161
153
|
end
|
162
154
|
|
155
|
+
|
156
|
+
number_of_tries = 0
|
157
|
+
while admin_credentials_invalid?(user.username, user.password)
|
158
|
+
number_of_tries = number_of_tries + 1
|
159
|
+
user.username = user.username + Random.rand(1..@max_connections).to_s
|
160
|
+
|
161
|
+
if number_of_tries > 30
|
162
|
+
response = create_response_json("failed_connection", nil, "The username exists already.")
|
163
|
+
yield response if block_given?
|
164
|
+
ws.send(response)
|
165
|
+
ws.close
|
166
|
+
break
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
163
170
|
number_of_tries = 0
|
164
171
|
while user_exists?(user)
|
165
172
|
number_of_tries = number_of_tries + 1
|
166
|
-
user.username = user.username + Random.rand(1
|
173
|
+
user.username = user.username + Random.rand(1..@max_connections).to_s
|
167
174
|
|
168
|
-
if number_of_tries >
|
175
|
+
if number_of_tries > 30
|
169
176
|
response = create_response_json("failed_connection", nil, "The username exists already.")
|
170
177
|
yield response if block_given?
|
171
178
|
ws.send(response)
|