diff --git a/.dynette.rb.swp b/.dynette.rb.swp index b39f7ce..51fa4ab 100644 Binary files a/.dynette.rb.swp and b/.dynette.rb.swp differ diff --git a/dynette.rb b/dynette.rb index 99666de..e2c8594 100755 --- a/dynette.rb +++ b/dynette.rb @@ -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)