Added duplicate email check.
This commit is contained in:
parent
4d1572dbe4
commit
9d72bb1ffa
1 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue