web_socket_chat_server 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9356cf8630f6b51f1247c21e7fd19f6e03683999
4
- data.tar.gz: 398040ec2b8113457d03b5112adc29593fd2632d
3
+ metadata.gz: 1eaef39c1692af8b3d3abe96c5a30a1fe8862fea
4
+ data.tar.gz: a06f9c5102984f25c0384b0fe16a7fd6781b2dd0
5
5
  SHA512:
6
- metadata.gz: f707f960a1357669e3a70b65ce8ab4e899c19630f97654701a0a6b6f40bdbd9bcc9478be4ea1892629936827d218c4678d8280e1bd671553f7f90eb0e18155c1
7
- data.tar.gz: 692171123a58fcecbff5900ccec3dbe94de978166b48016d4eadbeb593001c8cbf84d7a849bfa4d46e17383980ee4e1c9c7d6df836fd4c0a8539441f6281195c
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">Email</label>
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>
@@ -1,3 +1,3 @@
1
1
  module WebSocketChatServer
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -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..9999).to_s
173
+ user.username = user.username + Random.rand(1..@max_connections).to_s
167
174
 
168
- if number_of_tries > 15
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_socket_chat_server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jone Samra