From fda55f9145b5280db28cd6723789f95e2cb7b6c0 Mon Sep 17 00:00:00 2001
From: "RICKETTM@uk.ibm.com" <RICKETTM@uk.ibm.com>
Date: Tue, 24 Mar 2015 15:52:26 +0000
Subject: [PATCH] Change ordering so that confirm is removed from attrs before
 attempting to User.build_user

---
 lib/api/users.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/api/users.rb b/lib/api/users.rb
index 7c8b3250cd0..032a5d76e43 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -61,10 +61,10 @@ module API
         authenticated_as_admin!
         required_attributes! [:email, :password, :name, :username]
         attrs = attributes_for_keys [:email, :name, :password, :skype, :linkedin, :twitter, :projects_limit, :username, :bio, :can_create_group, :admin, :confirm]
-        user = User.build_user(attrs)
         admin = attrs.delete(:admin)
-        user.admin = admin unless admin.nil?
         confirm = !(attrs.delete(:confirm) =~ (/(false|f|no|0)$/i))
+        user = User.build_user(attrs)
+        user.admin = admin unless admin.nil?
         user.skip_confirmation! unless confirm
 
         identity_attrs = attributes_for_keys [:provider, :extern_uid]
-- 
GitLab