Compare commits

...

3 commits

Author SHA1 Message Date
Stanislas Dolcini
5c97123de2 Fix caps 2018-10-13 10:21:26 +02:00
Stanislas Dolcini
49ac78c4dd Another broken attemp 2018-10-13 10:20:21 +02:00
Stanislas Dolcini
b2353c109e Preliminary support for registering. 2018-10-12 22:20:24 +02:00
5 changed files with 55 additions and 7 deletions

View file

@ -0,0 +1,14 @@
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 + "\n" + "Password:" + self._password + "\n" + "ConfirmPass:" + self._password + "\n" + "Email:" + self._email+ "\n" + "TaC:" + ('1' if self._terms_accepted else '0');

View file

@ -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;

View file

@ -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", ["Content-Type: multipart/form-data"], true,HTTPClient.METHOD_POST,body.get_form_data());
# emit_signal( "cancel_button_pressed" )

View file

@ -386,7 +386,7 @@ mouse_default_cursor_shape = 0
size_flags_horizontal = 1 size_flags_horizontal = 1
size_flags_vertical = 4 size_flags_vertical = 4
custom_colors/font_color = Color( 0, 0, 0, 1 ) custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "e-mail" text = "E-mail"
percent_visible = 1.0 percent_visible = 1.0
lines_skipped = 0 lines_skipped = 0
max_lines_visible = -1 max_lines_visible = -1
@ -471,7 +471,7 @@ mouse_filter = 2
mouse_default_cursor_shape = 0 mouse_default_cursor_shape = 0
size_flags_horizontal = 1 size_flags_horizontal = 1
size_flags_vertical = 4 size_flags_vertical = 4
text = "j'accepte les" text = "J'accepte les"
percent_visible = 1.0 percent_visible = 1.0
lines_skipped = 0 lines_skipped = 0
max_lines_visible = -1 max_lines_visible = -1