diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index a9e527d2d..2e5189eda 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -161,6 +161,15 @@ curl http://localhost/api/users.json -v -u #{login}:#{password} -H "Content-Type end end + # check if user already exists + if user.email + exists = User.where( :email => user.email ).first + if exists + render :json => { :error => 'User already exists!' }, :status => :unprocessable_entity + return + end + end + user.save # send inviteation if needed / only if session exists