You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
2.8 KiB
GDScript
95 lines
2.8 KiB
GDScript
2 years ago
|
extends VBoxContainer
|
||
|
|
||
|
onready var legal_name = $Questions/Col1/HBox/Name
|
||
|
onready var day = $Questions/Col1/HBox2/Day
|
||
|
onready var month = $Questions/Col1/HBox2/Month
|
||
|
onready var year = $Questions/Col1/HBox2/Year
|
||
|
onready var gender = $Questions/Col1/HBox3/Gender
|
||
|
onready var password = $Questions/Col1/HBox4/Password
|
||
|
onready var password2 = $Questions/Col1/HBox5/Password2
|
||
|
onready var email = $Questions/Col2/HBox/Email
|
||
|
onready var secq = $Questions/Col2/HBox2/SecurityQ
|
||
|
onready var seca = $Questions/Col2/HBox3/SecurityA
|
||
|
onready var reason = $HBox/Reason
|
||
|
onready var etc = $HBox2/Etc
|
||
|
onready var submit = $Submit
|
||
|
onready var message = $HBox3/VBox/Message
|
||
|
onready var action = $HBox3/VBox/Action
|
||
|
onready var censor = 'res://Res/Text/censor.txt'
|
||
|
|
||
|
func check():
|
||
|
var form = collect_answers()
|
||
|
# Check Name is filled
|
||
|
if !form['name']:
|
||
|
message.set_text(tr("foif10"))
|
||
|
return false
|
||
|
# Check Name has special characters
|
||
|
for c in ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '{',
|
||
|
'}', '\'', '\"', ':', ';']:
|
||
|
if c in form['name']:
|
||
|
message.set_text(tr("foifb2"))
|
||
|
return false
|
||
|
# Check Name is offensive
|
||
|
var file = File.new()
|
||
|
file.open(censor, file.READ)
|
||
|
var line_counter = 0
|
||
|
while not file.eof_reached():
|
||
|
line_counter+=1
|
||
|
if file.get_line() in form['name']:
|
||
|
message.set_text(tr("foifb3"))
|
||
|
file.close()
|
||
|
return false
|
||
|
file.close()
|
||
|
# Check Name is taken
|
||
|
# message.set_text(tr("foifb4"))
|
||
|
# Check if >= 13
|
||
|
if form['age'] < 1:
|
||
|
message.set_text(tr("foifb5"))
|
||
|
return false
|
||
|
# Check Password is filled
|
||
|
if !form['password'] or !form['password2']:
|
||
|
message.set_text(tr("foif11"))
|
||
|
return false
|
||
|
# Check Password in top passwords
|
||
|
for p in ["123456","123456789","qwerty","password","12345","qwerty123","1q2w3e","12345678","111111","1234567890"]:
|
||
|
if form['password'] == p:
|
||
|
message.set_text(tr("foifb6"))
|
||
|
return false
|
||
|
# Check Passwords match
|
||
|
if form['password'] != form['password2']:
|
||
|
message.set_text(tr("foifb7"))
|
||
|
return false
|
||
|
# Check Email is valid
|
||
|
if !form['email']:
|
||
|
message.set_text(tr("foifb8"))
|
||
|
return false
|
||
|
# Check Account Recovery filled out
|
||
|
if !form['email'] and !form['secq'] and !form['seca']:
|
||
|
message.set_text(tr("foifb8"))
|
||
|
return false
|
||
|
# Also no name, etc
|
||
|
return true
|
||
|
|
||
|
func collect_answers():
|
||
|
return {
|
||
|
'name': legal_name.get_text(),
|
||
|
'dob': str(month.get_selected_id() + 1) + "/" + str(day.get_selected_id() + 1),
|
||
|
'age': year.get_selected_id(),
|
||
|
'gender': gender.get_selected_id(),
|
||
|
'password': password.get_text(),
|
||
|
'password2': password2.get_text(),
|
||
|
'email': email.get_text(),
|
||
|
'secq': secq.get_text(),
|
||
|
'seca': seca.get_text(),
|
||
|
'reason': reason.get_selected_id(),
|
||
|
'etc': etc.get_text()
|
||
|
}
|
||
|
|
||
|
func create_account():
|
||
|
if !check():
|
||
|
return
|
||
|
get_parent().get_parent().queue_free()
|
||
|
|
||
|
func _ready():
|
||
|
submit.connect("button_up", self, "create_account")
|