Recommiting glbs for LFS
Deploy Promiscuity Auth API / deploy (push) Successful in 1m59s
Deploy Promiscuity Character API / deploy (push) Successful in 1m16s
Deploy Promiscuity Inventory API / deploy (push) Has been cancelled
Deploy Promiscuity Locations API / deploy (push) Has been cancelled
Deploy Promiscuity Mail API / deploy (push) Has been cancelled
Deploy Promiscuity World API / deploy (push) Has been cancelled
Deploy Promiscuity Crafting API / deploy (push) Has been cancelled
k8s smoke test / test (push) Has been cancelled
Deploy Promiscuity Auth API / deploy (push) Successful in 1m59s
Deploy Promiscuity Character API / deploy (push) Successful in 1m16s
Deploy Promiscuity Inventory API / deploy (push) Has been cancelled
Deploy Promiscuity Locations API / deploy (push) Has been cancelled
Deploy Promiscuity Mail API / deploy (push) Has been cancelled
Deploy Promiscuity World API / deploy (push) Has been cancelled
Deploy Promiscuity Crafting API / deploy (push) Has been cancelled
k8s smoke test / test (push) Has been cancelled
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
extends Control
|
||||
|
||||
const AUTH_LOGIN_URL := "https://pauth.ranaze.com/api/Auth/login"
|
||||
|
||||
extends Control
|
||||
|
||||
const AUTH_LOGIN_URL := "https://pauth.ranaze.com/api/Auth/login"
|
||||
|
||||
@onready var _username_input: LineEdit = %UsernameInput
|
||||
@onready var _password_input: LineEdit = %PasswordInput
|
||||
@onready var _login_request: HTTPRequest = %LoginRequest
|
||||
@@ -18,38 +18,38 @@ func _on_log_in_button_pressed() -> void:
|
||||
var password := _password_input.text
|
||||
if username.is_empty() or password.is_empty():
|
||||
_show_error("Username and password required.")
|
||||
return
|
||||
|
||||
var payload := {
|
||||
"username": username,
|
||||
"password": password,
|
||||
}
|
||||
var headers := PackedStringArray(["Content-Type: application/json"])
|
||||
var err := _login_request.request(AUTH_LOGIN_URL, headers, HTTPClient.METHOD_POST, JSON.stringify(payload))
|
||||
if err != OK:
|
||||
_show_error("Failed to send login request.")
|
||||
|
||||
func _on_login_request_completed(result: int, response_code: int, _headers: PackedStringArray, body: PackedByteArray) -> void:
|
||||
var body_text := body.get_string_from_utf8()
|
||||
if result != HTTPRequest.RESULT_SUCCESS:
|
||||
_show_error("Network error. Please try again.")
|
||||
return
|
||||
|
||||
if response_code >= 200 and response_code < 300:
|
||||
var response: Variant = JSON.parse_string(body_text)
|
||||
if typeof(response) == TYPE_DICTIONARY:
|
||||
#print("Login success for %s" % response.get("username", "unknown"))
|
||||
#print("Access Token: %s" % response.get("accessToken", ""))
|
||||
var token := String(response.get("accessToken", ""))
|
||||
var username := String(response.get("username", ""))
|
||||
AuthState.set_session(username, token)
|
||||
get_tree().change_scene_to_file("res://scenes/UI/character_screen.tscn")
|
||||
else:
|
||||
_show_error("Login failed. Check your credentials.")
|
||||
|
||||
func _on_back_button_pressed() -> void:
|
||||
get_tree().change_scene_to_file("res://scenes/UI/start_screen.tscn")
|
||||
|
||||
return
|
||||
|
||||
var payload := {
|
||||
"username": username,
|
||||
"password": password,
|
||||
}
|
||||
var headers := PackedStringArray(["Content-Type: application/json"])
|
||||
var err := _login_request.request(AUTH_LOGIN_URL, headers, HTTPClient.METHOD_POST, JSON.stringify(payload))
|
||||
if err != OK:
|
||||
_show_error("Failed to send login request.")
|
||||
|
||||
func _on_login_request_completed(result: int, response_code: int, _headers: PackedStringArray, body: PackedByteArray) -> void:
|
||||
var body_text := body.get_string_from_utf8()
|
||||
if result != HTTPRequest.RESULT_SUCCESS:
|
||||
_show_error("Network error. Please try again.")
|
||||
return
|
||||
|
||||
if response_code >= 200 and response_code < 300:
|
||||
var response: Variant = JSON.parse_string(body_text)
|
||||
if typeof(response) == TYPE_DICTIONARY:
|
||||
#print("Login success for %s" % response.get("username", "unknown"))
|
||||
#print("Access Token: %s" % response.get("accessToken", ""))
|
||||
var token := String(response.get("accessToken", ""))
|
||||
var username := String(response.get("username", ""))
|
||||
AuthState.set_session(username, token)
|
||||
get_tree().change_scene_to_file("res://scenes/UI/character_screen.tscn")
|
||||
else:
|
||||
_show_error("Login failed. Check your credentials.")
|
||||
|
||||
func _on_back_button_pressed() -> void:
|
||||
get_tree().change_scene_to_file("res://scenes/UI/start_screen.tscn")
|
||||
|
||||
func _show_error(message: String) -> void:
|
||||
_error_label.text = message
|
||||
|
||||
|
||||
Reference in New Issue
Block a user