Fixed a bug where users could register with an already in-use username. Cleaned up registration logic
This commit is contained in:
+91
-365
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"firstLayout": "Login",
|
||||
"gdVersion": {
|
||||
"build": 274,
|
||||
"build": 275,
|
||||
"major": 5,
|
||||
"minor": 6,
|
||||
"revision": 0
|
||||
@@ -1827,7 +1827,7 @@
|
||||
"gridColor": 10401023,
|
||||
"gridAlpha": 0.8,
|
||||
"snap": true,
|
||||
"zoomFactor": 1.528913289223325,
|
||||
"zoomFactor": 4.567554687499995,
|
||||
"windowMask": false,
|
||||
"selectedLayer": "",
|
||||
"gameEditorMode": "instances-editor"
|
||||
@@ -1930,7 +1930,7 @@
|
||||
"persistentUuid": "4b4c3bd0-ffdf-440c-97a6-1992a4ae80d8",
|
||||
"width": 0,
|
||||
"x": 512,
|
||||
"y": 649,
|
||||
"y": 656,
|
||||
"zOrder": 5,
|
||||
"numberProperties": [],
|
||||
"stringProperties": [],
|
||||
@@ -2009,8 +2009,8 @@
|
||||
"name": "txt_RegMessagePassword",
|
||||
"persistentUuid": "16a3c795-1cfa-4633-bc35-3a823ceaf916",
|
||||
"width": 0,
|
||||
"x": 517,
|
||||
"y": 688,
|
||||
"x": 512,
|
||||
"y": 624,
|
||||
"zOrder": 12,
|
||||
"numberProperties": [],
|
||||
"stringProperties": [],
|
||||
@@ -2025,12 +2025,28 @@
|
||||
"name": "txt_RegMessageSuccess",
|
||||
"persistentUuid": "268fa5ba-bfd7-467f-80e6-1bf428f66436",
|
||||
"width": 0,
|
||||
"x": 521,
|
||||
"y": 617,
|
||||
"x": 512,
|
||||
"y": 624,
|
||||
"zOrder": 13,
|
||||
"numberProperties": [],
|
||||
"stringProperties": [],
|
||||
"initialVariables": []
|
||||
},
|
||||
{
|
||||
"angle": 0,
|
||||
"customSize": false,
|
||||
"height": 0,
|
||||
"keepRatio": true,
|
||||
"layer": "",
|
||||
"name": "txt_JSONReply",
|
||||
"persistentUuid": "be01192a-d6ad-4d98-8ef3-44c5c5fad5c2",
|
||||
"width": 0,
|
||||
"x": 84,
|
||||
"y": 105,
|
||||
"zOrder": 14,
|
||||
"numberProperties": [],
|
||||
"stringProperties": [],
|
||||
"initialVariables": []
|
||||
}
|
||||
],
|
||||
"objects": [
|
||||
@@ -2369,7 +2385,7 @@
|
||||
"variables": [],
|
||||
"effects": [],
|
||||
"behaviors": [],
|
||||
"string": "Registration Successful!",
|
||||
"string": "Registration Successful!\nGoing back to login screen",
|
||||
"font": "",
|
||||
"textAlignment": "center",
|
||||
"characterSize": 20,
|
||||
@@ -2392,7 +2408,7 @@
|
||||
"shadowOpacity": 127,
|
||||
"smoothed": true,
|
||||
"underlined": false,
|
||||
"text": "Registration Successful!",
|
||||
"text": "Registration Successful!\nGoing back to login screen",
|
||||
"font": "",
|
||||
"textAlignment": "center",
|
||||
"verticalTextAlignment": "top",
|
||||
@@ -2579,338 +2595,6 @@
|
||||
],
|
||||
"parameters": []
|
||||
},
|
||||
{
|
||||
"colorB": 228,
|
||||
"colorG": 176,
|
||||
"colorR": 74,
|
||||
"creationTime": 0,
|
||||
"folded": true,
|
||||
"name": "Register Button",
|
||||
"source": "",
|
||||
"type": "BuiltinCommonInstructions::Group",
|
||||
"events": [
|
||||
{
|
||||
"type": "BuiltinCommonInstructions::Comment",
|
||||
"color": {
|
||||
"b": 109,
|
||||
"g": 230,
|
||||
"r": 255,
|
||||
"textB": 0,
|
||||
"textG": 0,
|
||||
"textR": 0
|
||||
},
|
||||
"comment": "Check if username exists"
|
||||
},
|
||||
{
|
||||
"disabled": true,
|
||||
"type": "BuiltinCommonInstructions::Standard",
|
||||
"conditions": [
|
||||
{
|
||||
"type": {
|
||||
"value": "TextContainerCapability::TextContainerBehavior::Value"
|
||||
},
|
||||
"parameters": [
|
||||
"txtbx_regUsername",
|
||||
"Text",
|
||||
"!=",
|
||||
"\"\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"inverted": true,
|
||||
"value": "TextInput::TextInputObject::Focused"
|
||||
},
|
||||
"parameters": [
|
||||
"txtbx_regUsername"
|
||||
]
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"type": {
|
||||
"value": "SetStringVariable"
|
||||
},
|
||||
"parameters": [
|
||||
"var_username",
|
||||
"=",
|
||||
"txtbx_regUsername.Text::Value()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"value": "SendAsyncRequest"
|
||||
},
|
||||
"parameters": [
|
||||
"var_jsonAddress+\"/users?username=\" + var_username",
|
||||
"",
|
||||
"\"GET\"",
|
||||
"",
|
||||
"var_jsonReply",
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"value": "TextContainerCapability::TextContainerBehavior::SetValue"
|
||||
},
|
||||
"parameters": [
|
||||
"txt_JSONReply",
|
||||
"Text",
|
||||
"=",
|
||||
"var_jsonReply"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BuiltinCommonInstructions::Comment",
|
||||
"color": {
|
||||
"b": 109,
|
||||
"g": 230,
|
||||
"r": 255,
|
||||
"textB": 0,
|
||||
"textG": 0,
|
||||
"textR": 0
|
||||
},
|
||||
"comment": "Password Match"
|
||||
},
|
||||
{
|
||||
"disabled": true,
|
||||
"type": "BuiltinCommonInstructions::Standard",
|
||||
"conditions": [
|
||||
{
|
||||
"type": {
|
||||
"inverted": true,
|
||||
"value": "TextInput::TextInputObject::Focused"
|
||||
},
|
||||
"parameters": [
|
||||
"txtbx_regPassword01"
|
||||
]
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"type": {
|
||||
"value": "SetStringVariable"
|
||||
},
|
||||
"parameters": [
|
||||
"var_password01",
|
||||
"=",
|
||||
"txtbx_regPassword01.Text::Value()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"value": "SetStringVariable"
|
||||
},
|
||||
"parameters": [
|
||||
"var_password02",
|
||||
"=",
|
||||
"txtbx_regPassword02.Text::Value()"
|
||||
]
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
{
|
||||
"disabled": true,
|
||||
"type": "BuiltinCommonInstructions::Standard",
|
||||
"conditions": [
|
||||
{
|
||||
"type": {
|
||||
"value": "StringVariable"
|
||||
},
|
||||
"parameters": [
|
||||
"var_password01",
|
||||
"!=",
|
||||
"var_password02"
|
||||
]
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"type": {
|
||||
"value": "TextContainerCapability::TextContainerBehavior::SetValue"
|
||||
},
|
||||
"parameters": [
|
||||
"txt_RegMessagePassword",
|
||||
"Text",
|
||||
"=",
|
||||
"\"Password do not match\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"value": "Show"
|
||||
},
|
||||
"parameters": [
|
||||
"txt_RegMessagePassword",
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"value": "TextObject::ChangeColor"
|
||||
},
|
||||
"parameters": [
|
||||
"txt_RegMessagePassword",
|
||||
"\"255;0;0\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"value": "SetCenterX"
|
||||
},
|
||||
"parameters": [
|
||||
"txt_RegMessagePassword",
|
||||
"=",
|
||||
"btn_Back.CenterX()"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"disabled": true,
|
||||
"type": "BuiltinCommonInstructions::Else",
|
||||
"conditions": [],
|
||||
"actions": [
|
||||
{
|
||||
"type": {
|
||||
"value": "Hide"
|
||||
},
|
||||
"parameters": [
|
||||
"txt_RegMessagePassword"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BuiltinCommonInstructions::Comment",
|
||||
"color": {
|
||||
"b": 109,
|
||||
"g": 230,
|
||||
"r": 255,
|
||||
"textB": 0,
|
||||
"textG": 0,
|
||||
"textR": 0
|
||||
},
|
||||
"comment": "If username does not exist, write to database"
|
||||
},
|
||||
{
|
||||
"disabled": true,
|
||||
"type": "BuiltinCommonInstructions::Standard",
|
||||
"conditions": [
|
||||
{
|
||||
"type": {
|
||||
"value": "PanelSpriteButton::PanelSpriteButton::IsClicked"
|
||||
},
|
||||
"parameters": [
|
||||
"btn_regRegister",
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"value": "TextContainerCapability::TextContainerBehavior::Value"
|
||||
},
|
||||
"parameters": [
|
||||
"txtbx_regUsername",
|
||||
"Text",
|
||||
"!=",
|
||||
"\"\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"value": "TextContainerCapability::TextContainerBehavior::Value"
|
||||
},
|
||||
"parameters": [
|
||||
"txtbx_regPassword01",
|
||||
"Text",
|
||||
"!=",
|
||||
"\"\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"value": "StringVariable"
|
||||
},
|
||||
"parameters": [
|
||||
"var_jsonReply",
|
||||
"=",
|
||||
"\"[]\""
|
||||
]
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"type": {
|
||||
"value": "SetStringVariable"
|
||||
},
|
||||
"parameters": [
|
||||
"var_password01",
|
||||
"=",
|
||||
"txtbx_regPassword01.Text::Value()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"value": "SendAsyncRequest"
|
||||
},
|
||||
"parameters": [
|
||||
"var_jsonAddress+\"/users\"",
|
||||
"\"{\\\"username\\\":\\\"\" + var_username + \"\\\",\\\"password\\\":\\\"\" + var_password01 + \"\\\",\\\"color\\\":\\\"\" + var_colorGen+ \"\\\",\\\"room\\\":\\\"000000\\\"}\"",
|
||||
"\"POST\"",
|
||||
"\"application/json\"",
|
||||
"",
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"value": "TextContainerCapability::TextContainerBehavior::SetValue"
|
||||
},
|
||||
"parameters": [
|
||||
"txt_RegMessageUser",
|
||||
"Text",
|
||||
"=",
|
||||
"\"Registration Successful! Please Log In\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"value": "Show"
|
||||
},
|
||||
"parameters": [
|
||||
"txt_RegMessageUser",
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"value": "Wait"
|
||||
},
|
||||
"parameters": [
|
||||
"3"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"value": "Scene"
|
||||
},
|
||||
"parameters": [
|
||||
"",
|
||||
"\"Login\"",
|
||||
""
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"parameters": []
|
||||
},
|
||||
{
|
||||
"colorB": 228,
|
||||
"colorG": 176,
|
||||
@@ -3056,9 +2740,68 @@
|
||||
"var_jsonReply",
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"value": "Wait"
|
||||
},
|
||||
"parameters": [
|
||||
".1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"value": "TextContainerCapability::TextContainerBehavior::SetValue"
|
||||
},
|
||||
"parameters": [
|
||||
"txt_JSONReply",
|
||||
"Text",
|
||||
"=",
|
||||
"var_jsonReply"
|
||||
]
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
{
|
||||
"type": "BuiltinCommonInstructions::Standard",
|
||||
"conditions": [
|
||||
{
|
||||
"type": {
|
||||
"value": "StringVariable"
|
||||
},
|
||||
"parameters": [
|
||||
"var_jsonReply",
|
||||
"!=",
|
||||
"\"[]\""
|
||||
]
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"type": {
|
||||
"value": "Show"
|
||||
},
|
||||
"parameters": [
|
||||
"txt_RegMessageUser",
|
||||
""
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BuiltinCommonInstructions::Else",
|
||||
"conditions": [],
|
||||
"actions": [
|
||||
{
|
||||
"type": {
|
||||
"value": "Hide"
|
||||
},
|
||||
"parameters": [
|
||||
"txt_RegMessageUser"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BuiltinCommonInstructions::Standard",
|
||||
"conditions": [
|
||||
@@ -3108,35 +2851,18 @@
|
||||
},
|
||||
"parameters": [
|
||||
"var_jsonReply",
|
||||
"!=",
|
||||
"=",
|
||||
"\"[]\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"value": "BuiltinCommonInstructions::Once"
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"type": {
|
||||
"value": "Show"
|
||||
},
|
||||
"parameters": [
|
||||
"txt_RegMessageUser",
|
||||
""
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BuiltinCommonInstructions::Else",
|
||||
"conditions": [],
|
||||
"actions": [
|
||||
{
|
||||
"type": {
|
||||
"value": "Hide"
|
||||
},
|
||||
"parameters": [
|
||||
"txt_RegMessageUser"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"value": "Show"
|
||||
|
||||
Reference in New Issue
Block a user