From a1112347d4e0b66240b70cb80922afd27cf2a7c8 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Wed, 16 Jul 2014 01:18:29 +0530 Subject: [PATCH] FIX: Instead of silently failing, assign alternative username when provided username is invalid in disposable invite --- app/models/invite_redeemer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/invite_redeemer.rb b/app/models/invite_redeemer.rb index 81fb3c218c8..c7eb58711c9 100644 --- a/app/models/invite_redeemer.rb +++ b/app/models/invite_redeemer.rb @@ -22,7 +22,7 @@ InviteRedeemer = Struct.new(:invite, :username, :name) do user_exists = User.find_by_email(invite.email) return user if user_exists - if username && User.username_available?(username) + if username && UsernameValidator.new(username).valid_format? && User.username_available?(username) available_username = username else available_username = UserNameSuggester.suggest(invite.email)