This commit is contained in:
Kload 2013-06-15 20:19:33 +00:00
parent d39dfae312
commit dc07f45e9e
2 changed files with 6 additions and 2 deletions

Binary file not shown.

View file

@ -43,8 +43,12 @@ post '/' do
# If already exists
status 409
return { :error => "Subdomain already taken: #{entry.subdomain}.#{DOMAIN}" } if entry = Entry.first(:subdomain => params[:subdomain])
return { :error => "Key already exists for domain #{entry.subdomain}.#{DOMAIN}" } if entry = Entry.first(:public_key => params[:public_key])
if entry = Entry.first(:subdomain => params[:subdomain])
return { :error => "Subdomain already taken: #{entry.subdomain}.#{DOMAIN}" }
end
if entry = Entry.first(:public_key => params[:public_key])
return { :error => "Key already exists for domain #{entry.subdomain}.#{DOMAIN}" }
end
# Process
entry = Entry.new(:public_key => params[:public_key], :subdomain => params[:subdomain], :current_ip => request.ip)