mirror of
https://github.com/neocities/neocities.git
synced 2025-07-25 11:58:28 +02:00
initial contact form for domain registration
This commit is contained in:
parent
f026d9d5fe
commit
47c0e52d93
7 changed files with 1051 additions and 1 deletions
29
app/domain.rb
Normal file
29
app/domain.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
get '/domain/new' do
|
||||
require_login
|
||||
@title = 'Register a Domain'
|
||||
|
||||
erb :'domain/new'
|
||||
end
|
||||
|
||||
post '/domain/check_availability.json' do
|
||||
require_login
|
||||
content_type :json
|
||||
|
||||
timer = Time.now.to_i
|
||||
|
||||
while true
|
||||
if (Time.now.to_i - timer) > 60
|
||||
api_error 200, :contact_fail, 'Error contacting domain server, please try again.'
|
||||
end
|
||||
|
||||
begin
|
||||
res = $gandi.domain.available([params[:domain]])[params[:domain]]
|
||||
rescue => Gandi::DataError
|
||||
api_error 200, :invalid_domain, 'Domain name was invalid, please try another.'
|
||||
end
|
||||
|
||||
api_success res unless res == 'pending'
|
||||
sleep 0.2
|
||||
end
|
||||
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue