Working version, need to enforce https

This commit is contained in:
Stanislas Dolcini 2018-10-08 12:18:33 +02:00
parent cb03be2718
commit 5e715d09af

View file

@ -9,8 +9,11 @@ func _on_login_button_pressed():
func _on_play_button_pressed(): func _on_play_button_pressed():
#emit_signal( "login_button_pressed" ) #emit_signal( "login_button_pressed" )
var username = get_node("h_box_container/v_box_container/margin_container/login_box/email_box/email_edit").get_text(); var username = get_node("h_box_container/v_box_container/margin_container/login_box/email_box/email_edit").get_text();
if username != null and username != "": var password = get_node("h_box_container/v_box_container/margin_container/login_box/password_box/password_edit").get_text();
do_request(username) if username != null and username != "" and password != null and password != "":
do_request(username, password)
func _on_quit_button_pressed(): func _on_quit_button_pressed():
@ -24,13 +27,14 @@ func _on_sound_button_toggled( button_pressed ):
global.get_node( "audio_stream_player" ).play() global.get_node( "audio_stream_player" ).play()
func do_request(username): func do_request(username, password):
var message = load("res://assets/Scripts/Models/nel_login_message.gd").nel_login_message.new("ask", username, "", "", "", ""); var message = load("res://assets/Scripts/Models/nel_login_message.gd").nel_login_message.new("https-login", username, password, "Lirria", "2", "en");
$HTTPRequest.request("http://lirria.khaganat.net/login/r2_login.php?" + message.get_request_string()); # $HTTPRequest.request("http://lirria.khaganat.net/login/r2_login.php?" + message.get_request_string());
$HTTPRequest.request("http://149.91.80.160/login/r2_login.php?" + message.get_request_string());
func _on_HTTPRequest_request_completed(result, response_code, headers, body): func _on_HTTPRequest_request_completed(result, response_code, headers, body):
var s = body.get_string_from_utf8().split(":") var s = body.get_string_from_utf8().split(":")
print(s)
var ctn = s[1] var ctn = s[1]
print(ctn) print(ctn)