Only go to the next window if login is successful

This commit is contained in:
Stanislas Dolcini 2018-10-08 12:24:07 +02:00
parent 5e715d09af
commit ec58b28375

View file

@ -7,7 +7,6 @@ func _on_login_button_pressed():
func _on_play_button_pressed(): func _on_play_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();
var password = get_node("h_box_container/v_box_container/margin_container/login_box/password_box/password_edit").get_text(); var password = get_node("h_box_container/v_box_container/margin_container/login_box/password_box/password_edit").get_text();
if username != null and username != "" and password != null and password != "": if username != null and username != "" and password != null and password != "":
@ -34,9 +33,10 @@ func do_request(username, password):
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[0]
var ctn = s[1] # No error so login was successful.
print(ctn) if(ctn != "0"):
emit_signal( "login_button_pressed" )
func _make_post_request(url, data_to_send, use_ssl): func _make_post_request(url, data_to_send, use_ssl):