Merge pull request 'feat: added authorization' (#5) from develop into production
Reviewed-on: #5production
commit
7b16271dcf
|
@ -18,10 +18,12 @@ func _init():
|
|||
#--------------------------------------------------------------------------------------------------#
|
||||
# RPC Client
|
||||
@rpc("authority", "reliable", "call_remote", 1)
|
||||
func authorizated(_token, _isAuthorized):
|
||||
func authorizated(_name, _token, _isAuthorized):
|
||||
if _isAuthorized:
|
||||
if GATEWAY.debug:
|
||||
print("Client token: " + _token)
|
||||
token = _token
|
||||
playerName = _name
|
||||
GATEWAY.emit_signal("authorizated")
|
||||
else:
|
||||
GATEWAY.emit_signal("unauthorizated")
|
||||
|
|
|
@ -12,6 +12,7 @@ func _ready():
|
|||
multiplayer.server_disconnected.connect(_on_server_disconnected)
|
||||
multiplayer.connection_failed.connect(_on_connected_fail)
|
||||
GATEWAY.unauthorizated.connect(_on_authorization_fail)
|
||||
GATEWAY.authorizated.connect(_on_authorization_ok)
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------#
|
||||
|
@ -29,7 +30,7 @@ func _on_login_btn_button_down():
|
|||
if response != Error.OK:
|
||||
InfoText.text = "Error connect to %s on port %s. ERROR: %s" % [GATEWAY.settings.Ip, GATEWAY.settings.Port, error_string(response)]
|
||||
else:
|
||||
response = GATEWAY.rpc_id(1, 'authorization', LoginInput.text, PasswordInput.text)
|
||||
response = GATEWAY.rpc_id(1, 'authorization', LoginInput.text, PasswordInput.text.md5_text())
|
||||
|
||||
|
||||
func _on_connected_ok():
|
||||
|
@ -56,3 +57,7 @@ func _on_authorization_fail():
|
|||
LoginBtn.disabled = false
|
||||
LoginInput.editable = true
|
||||
PasswordInput.editable = true
|
||||
|
||||
|
||||
func _on_authorization_ok():
|
||||
pass
|
||||
|
|
|
@ -13,6 +13,7 @@ var clientId : int
|
|||
|
||||
# Signals
|
||||
signal unauthorizated
|
||||
signal authorizated
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------#
|
||||
|
|
Loading…
Reference in New Issue