|
@@ -4,16 +4,15 @@ var net = NetworkedMultiplayerENet.new()
|
|
|
var api = MultiplayerAPI.new()
|
|
|
var port = 1909
|
|
|
var maxplayer = 100
|
|
|
-export(NodePath) var database
|
|
|
-var cert = load('user://Certificate/x509_Certificate.crt')
|
|
|
-var key = load('user://Certificate/x509_Key.key')
|
|
|
+#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)
|
|
|
+# 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)
|
|
@@ -30,17 +29,23 @@ 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 == '':
|
|
|
- message = 'put in a username'
|
|
|
- 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'
|
|
|
+# 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
|
|
|
+# 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())
|