Permalink
Browse files

Usernames must be only letters, numbers and underscores

  • Loading branch information...
1 parent 74df792 commit 14c14e210a01ef8edcde6b75a91262785652ead6 @danlucraft committed May 24, 2009
Showing with 3 additions and 1 deletion.
  1. +3 −1 login-signup.rb
View
@@ -24,7 +24,9 @@
end
post '/signup' do
- if redis.key?("user:username:#{params[:username]}")
+ if params[:username] !~ /^\w+$/
+ @signup_error = "Username must only contain letters, numbers and underscores."
+ elsif redis.key?("user:username:#{params[:username]}")
@signup_error = "That username is taken."
elsif params[:username].length < 4
@signup_error = "Username must be at least 4 characters"

0 comments on commit 14c14e2

Please sign in to comment.