summaryrefslogtreecommitdiff
path: root/lib/api/users.rb
diff options
context:
space:
mode:
authorMatthew Monaco <matt@monaco.cx>2014-06-18 11:49:39 -0600
committerMatthew Monaco <matt@monaco.cx>2014-11-03 15:37:13 -0700
commit5f682094d9b7c985ad62ebe29664bb6fe87b54be (patch)
treeb5b50566c04a62ea186da1ce41d3634fb015b125 /lib/api/users.rb
parentd7c50b4a95b5530ae0e2f5249cfd9a419dd940c6 (diff)
downloadgitlab-ce-5f682094d9b7c985ad62ebe29664bb6fe87b54be.tar.gz
Add 'confirm' option to users api
Diffstat (limited to 'lib/api/users.rb')
-rw-r--r--lib/api/users.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb
index d07815a8a97..1a4a8535d48 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -54,15 +54,18 @@ module API
# bio - Bio
# admin - User is admin - true or false (default)
# can_create_group - User can create groups - true or false
+ # confirm - Require user confirmation - true (default) or false
# Example Request:
# POST /users
post do
authenticated_as_admin!
required_attributes! [:email, :password, :name, :username]
- attrs = attributes_for_keys [:email, :name, :password, :skype, :linkedin, :twitter, :projects_limit, :username, :extern_uid, :provider, :bio, :can_create_group, :admin]
+ attrs = attributes_for_keys [:email, :name, :password, :skype, :linkedin, :twitter, :projects_limit, :username, :extern_uid, :provider, :bio, :can_create_group, :confirm, :admin]
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.skip_confirmation! unless confirm
if user.save
present user, with: Entities::UserFull
else