-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNewAccount.gd
62 lines (47 loc) · 1.42 KB
/
NewAccount.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
extends Control
var OpenSeed
var username = ""
var passphrase = ""
var email = ""
signal login(status)
# Called when the node enters the scene tree for the first time.
func _ready():
OpenSeed = get_node("/root/OpenSeed")
OpenSeed.connect("accountdata",self,"verify_account")
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_Username_text_changed(new_text):
username = new_text
func _on_Email_text_changed(new_text):
email = new_text
func _on_Passphrase_text_changed(new_text):
passphrase = new_text
func _on_Create_pressed():
if username and passphrase and email:
OpenSeed.openSeedRequest("create_account",[username,passphrase,email])
else:
$notification.text = "Please fill in all fields"
pass # Replace with function body.
func _on_Cancel_pressed():
self.hide()
OpenSeed.get_node("CanvasLayer/Login").show()
func verify_account(data):
if typeof(data) == TYPE_DICTIONARY:
match data["token"]:
'denied':
$notification.text = "User Exists"
#emit_signal("login",0)
_:
$notification.text = "granted"
emit_signal("login",1)
if len(OpenSeed.token) < 2:
OpenSeed.token = data["token"]
print(OpenSeed.token)
OpenSeed.username = username
OpenSeed.steem = ""
OpenSeed.saveUserData()
self.hide()
func _on_NewAccount_visibility_changed():
pass # Replace with function body.