123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- extends Node
- var net = NetworkedMultiplayerENet.new()
- var api = MultiplayerAPI.new()
- var port = 1909
- var maxplayer = 100
- #var cert = load('user://Certificate/x509_Certificate.crt')
- #var key = load('user://Certificate/x509_Key.key')
- func _ready():
- print('Login listening to port: ' + str(port))
- net.create_server(port, maxplayer)
- # net.set_dtls_key(key)
- # net.set_dtls_certificate(cert)
- # net.set_dtls_enabled(true)
- self.set_custom_multiplayer(api)
- custom_multiplayer.set_root_node(self)
- custom_multiplayer.set_network_peer(net)
-
- # net.connect("peer_disconnected",self,"disc")
- net.connect("peer_connected",self,"conn")
- pass # Replace with function body.
- func _process(_delta):
- custom_multiplayer.poll()
- var playerphsyics = preload('res://playerphysics.tscn')
- func conn(id):
- print('login client connected, id: ' + str(id))
- export(NodePath) var PostgreSQL
- remote func RegisterPlayer(username, password, password2, email, salt, requester):
- var message = 'registering...'
- # if password != password2:
- # message = 'passwords are not equal'
- # if username.length() < 3:
- # message = 'username must be at least three letters'
- # if email.find('@') == -1 or email.find('@') == 0:
- # message = 'email is invalid'
- # if email.find('gmail') == -1 and email.find('outlook') == -1 and email.find('yahoo') == -1:
- # message = 'not a supported email provider'
- # if email.find('.com') == -1:
- # message = 'email is invalid'
- print(message)
- rpc_id(api.get_rpc_sender_id(), 'update_status', message)
- # if message == 'registering...': return
- for i in 1024: password = (password+salt).sha256_text()
- print('adding new data to the login db...')
- get_node(PostgreSQL).Create('login_db',['email','username','password','salt','creation_date'],email, username, password, salt, OS.get_unix_time())
|