Commit f8b3f23c authored by Cool Fire's avatar Cool Fire

Split portions off into logical subfiles

parent df4261f8
Pipeline #325 passed with stages
in 1 minute and 31 seconds
# frozen_string_literal: true
# Invite code handling
class SignupSite < Sinatra::Base
get '/enter-code' do
ec = YAML.load_file('content/enter-code.yaml')
@header = ec['header']
@body = ec['body']
@form = erb :enter_code
@progress = 25
erb :index
end
post '/check-code' do
if (!params.key? :input_invite) ||
params[:input_invite].empty? ||
params[:input_invite] !~ /^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/
@header = 'Insomnia 24/7 shells signup'
@body = 'Invite code appears to be invalid. Please try again.'
@progress = 25
erb :index
else
session[:invite] = Rack::Utils.escape_html(params[:input_invite])
redirect '/enter-details', 302
end
end
end
# frozen_string_literal: true
# Singup details handling
class SignupSite < Sinatra::Base
get '/enter-details' do
ed = YAML.load_file('content/enter-details.yaml')
@header = ed['header']
@blurb = ed['blurb']
@body = ed['body']
@form = erb :enter_details
@progress = 50
erb :index
end
post '/check-details' do
# Some checking stuff
end
end
......@@ -17,42 +17,7 @@ class SignupSite < Sinatra::Base
@progress = 0
erb :index
end
get '/enter-code' do
ec = YAML.load_file('content/enter-code.yaml')
@header = ec['header']
@body = ec['body']
@form = erb :enter_code
@progress = 25
erb :index
end
post '/check-code' do
if (!params.key? :input_invite) ||
params[:input_invite].empty? ||
params[:input_invite] !~ /^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/
@header = 'Insomnia 24/7 shells signup'
@body = 'Invite code appears to be invalid. Please try again.'
@progress = 25
erb :index
else
session[:invite] = Rack::Utils.escape_html(params[:input_invite])
redirect '/enter-details', 302
end
end
get '/enter-details' do
ed = YAML.load_file('content/enter-details.yaml')
@header = ed['header']
@blurb = ed['blurb']
@body = ed['body']
@form = erb :enter_details
@progress = 50
erb :index
end
post '/check-details' do
# Some checking stuff
end
end
require_relative 'routes/code'
require_relative 'routes/details'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment