mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +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
|
|
@ -823,6 +823,10 @@ class Site < Sequel::Model
|
||||||
errors.add :email, 'An email address is required.'
|
errors.add :email, 'An email address is required.'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if parent? && values[:email] =~ /@neocities.org/
|
||||||
|
errors.add :email, 'Cannot use this email address.'
|
||||||
|
end
|
||||||
|
|
||||||
# Check for existing email if new or changing email.
|
# Check for existing email if new or changing email.
|
||||||
if new? || @original_email
|
if new? || @original_email
|
||||||
email_check = self.class.select(:id).filter(email: values[:email])
|
email_check = self.class.select(:id).filter(email: values[:email])
|
||||||
|
|
File diff suppressed because one or more lines are too long
BIN
public/img/loading.gif
Normal file
BIN
public/img/loading.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
1001
views/domain/new.erb
Normal file
1001
views/domain/new.erb
Normal file
File diff suppressed because it is too large
Load diff
|
@ -24,6 +24,7 @@
|
||||||
<div class="tabbable" style="margin-top: 20px"> <!-- Only required for left/right tabs -->
|
<div class="tabbable" style="margin-top: 20px"> <!-- Only required for left/right tabs -->
|
||||||
<ul class="nav nav-tabs">
|
<ul class="nav nav-tabs">
|
||||||
<li class="active"><a href="#profile" data-toggle="tab">Profile</a></li>
|
<li class="active"><a href="#profile" data-toggle="tab">Profile</a></li>
|
||||||
|
<li><a href="#domain" data-toggle="tab">Domain Name</a></li>
|
||||||
<li><a href="#custom_domain" data-toggle="tab">Custom Domain</a></li>
|
<li><a href="#custom_domain" data-toggle="tab">Custom Domain</a></li>
|
||||||
<li><a href="#username" data-toggle="tab">Change Site (User) Name</a></li>
|
<li><a href="#username" data-toggle="tab">Change Site (User) Name</a></li>
|
||||||
|
|
||||||
|
@ -37,6 +38,9 @@
|
||||||
<div class="tab-pane active" id="profile">
|
<div class="tab-pane active" id="profile">
|
||||||
<%== erb :'settings/site/profile' %>
|
<%== erb :'settings/site/profile' %>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="tab-pane" id="domain">
|
||||||
|
<%== erb :'settings/site/domain' %>
|
||||||
|
</div>
|
||||||
<div class="tab-pane" id="custom_domain">
|
<div class="tab-pane" id="custom_domain">
|
||||||
<%== erb :'settings/site/custom_domain' %>
|
<%== erb :'settings/site/custom_domain' %>
|
||||||
</div>
|
</div>
|
||||||
|
|
12
views/settings/site/domain.erb
Normal file
12
views/settings/site/domain.erb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<h2>Create a domain name</h2>
|
||||||
|
<h3 class="subtitle">Register a domain name for your Neocities site!</h3>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Neocities now allows you to create a domain name for your site directly through Neocities. Instead of being at <%= current_site.username %>.neocities.org, your site would be accessible via your full domain name (example.com). You get one free domain per Neocities account.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<% if parent_site.supporter? %>
|
||||||
|
<a href="/domain/new">Register your domain name now</a>
|
||||||
|
<% else %>
|
||||||
|
<strong>Getting a domain name requires a Supporter account. <a href="/plan">Upgrade now</a>.</strong>
|
||||||
|
<% end %>
|
Loading…
Add table
Reference in a new issue