Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Usernames must be only letters, numbers and underscores

  • Loading branch information...
commit 14c14e210a01ef8edcde6b75a91262785652ead6 1 parent 74df792
Dan Lucraft authored

Showing 1 changed file with 3 additions and 1 deletion. Show diff stats Hide diff stats

  1. 4  login-signup.rb
4  login-signup.rb
@@ -24,7 +24,9 @@
24 24
 end
25 25
 
26 26
 post '/signup' do
27  
-  if redis.key?("user:username:#{params[:username]}")
  27
+  if params[:username] !~ /^\w+$/
  28
+    @signup_error = "Username must only contain letters, numbers and underscores."
  29
+  elsif redis.key?("user:username:#{params[:username]}")
28 30
     @signup_error = "That username is taken."
29 31
   elsif params[:username].length < 4
30 32
     @signup_error = "Username must be at least 4 characters"

0 notes on commit 14c14e2

Please sign in to comment.
Something went wrong with that request. Please try again.