Preliminary support for registering.
This commit is contained in:
parent
2de2459411
commit
b2353c109e
4 changed files with 59 additions and 5 deletions
20
assets/Scripts/Models/nel_register_form.gd
Normal file
20
assets/Scripts/Models/nel_register_form.gd
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
class nel_register_form:
|
||||||
|
var _username;
|
||||||
|
var _password;
|
||||||
|
var _email;
|
||||||
|
var _terms_accepted;
|
||||||
|
|
||||||
|
func _init(username, password, email, terms_accepted):
|
||||||
|
self._username = username;
|
||||||
|
self._password = password;
|
||||||
|
self._email = email;
|
||||||
|
self._terms_accepted = terms_accepted;
|
||||||
|
|
||||||
|
func get_form_data():
|
||||||
|
return {
|
||||||
|
"Username": self._username,
|
||||||
|
"Password": self._password,
|
||||||
|
"ConfirmPass": self._password,
|
||||||
|
"Email": self._email,
|
||||||
|
"TaC": 1 if self._terms_accepted else 0
|
||||||
|
}
|
|
@ -3,7 +3,7 @@ class nel_server_info:
|
||||||
var _shardIp;
|
var _shardIp;
|
||||||
var _ringStartAdress;
|
var _ringStartAdress;
|
||||||
var _ringAddress;
|
var _ringAddress;
|
||||||
var _patchVersion
|
var _patchVersion;
|
||||||
var _backupPatchUrls;
|
var _backupPatchUrls;
|
||||||
var _patchUrls;
|
var _patchUrls;
|
||||||
|
|
||||||
|
|
|
@ -15,3 +15,37 @@ func _on_cancel_button_pressed():
|
||||||
|
|
||||||
func _on_license_button_pressed():
|
func _on_license_button_pressed():
|
||||||
emit_signal( "license_button_pressed" )
|
emit_signal( "license_button_pressed" )
|
||||||
|
# No error so login was successful.
|
||||||
|
|
||||||
|
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
|
||||||
|
var s = body.get_string_from_utf8();
|
||||||
|
print(s);
|
||||||
|
emit_signal( "cancel_button_pressed");
|
||||||
|
# if(s[0] != "0"):
|
||||||
|
# var server_info_script = load("res://assets/Scripts/Models/nel_server_info.gd");
|
||||||
|
# var server_info = server_info_script.nel_server_info.new(body.get_string_from_utf8());
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
func _on_register_button_pressed():
|
||||||
|
var username = get_node("h_box_container/v_box_container/center_container/register_box/login_box/login_edit").get_text();
|
||||||
|
var password = get_node("h_box_container/v_box_container/center_container/register_box/password_box/password_edit").get_text();
|
||||||
|
var password_confirm = get_node("h_box_container/v_box_container/center_container/register_box/password_confirm_box/password_edit").get_text();
|
||||||
|
var email = get_node("h_box_container/v_box_container/center_container/register_box/email_box/email_edit").get_text();
|
||||||
|
var license_accepted = get_node("h_box_container/v_box_container/center_container/register_box/license_box/check_box").is_pressed();
|
||||||
|
|
||||||
|
if (username != null and username != ""):
|
||||||
|
if(password != null and password != ""):
|
||||||
|
if(password_confirm != null and password_confirm != ""):
|
||||||
|
if(password_confirm == password):
|
||||||
|
if(email != null and email != ""):
|
||||||
|
if(license_accepted == true):
|
||||||
|
print("Doing request");
|
||||||
|
var body = load("res://assets/Scripts/Models/nel_register_form.gd").nel_register_form.new(username, password, email, license_accepted);
|
||||||
|
$HTTPRequest.request("http://149.91.80.160/ams/index.php?action=add_user", "", true,HTTPClient.METHOD_POST,body.get_form_data());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# emit_signal( "cancel_button_pressed" )
|
||||||
|
|
Loading…
Reference in a new issue