now matching providers

This commit is contained in:
Yessiest 2023-05-07 22:39:42 +04:00
parent a1bcbd8402
commit 9eccd6b74a
2 changed files with 12 additions and 2 deletions

1
providers.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,16 @@ require 'json'
require 'uri'
require 'openssl'
norxondor_gorgonax = URI::MailTo::EMAIL_REGEXP
shitlist_f = File.open(Dir.pwd+"/providers.json", "r")
SHITLIST = shitlist_f.read
shitlist_f.close
def norxondor_gorgonax(email)
# Step 1:
return false unless email.match URI::MailTo::EMAIL_REGEXP
# Step 2:
return false unless (SHITLIST.include? "\"#{(email.match /(?<=@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\z/)[0]}\"")
return true
end
config_file = File.new Dir.pwd+"/.config.json", "r"
CONFIG = JSON.load(config_file)
config_file.close
@ -82,7 +91,7 @@ server = Hyde::Server.new Host: "192.168.1.27", Port: HTTP_PORT do
expires_on = Time.now+60*60*2
# Match query parameters against given rules
unless user.match /^[\w_-]+$/ and
email.match norxondor_gorgonax and
norxondor_gorgonax(email) and
password.match /^.{8,}$/ then
redirect server_uri+"/register/error.html"
end