|
@@ -377,37 +377,34 @@ Element function user_function():
|
|
|
// Load in a hard-reference to the previously created model
|
|
|
core = import_node(core_model_location)
|
|
|
|
|
|
- output("Log on as which user?")
|
|
|
- username = input()
|
|
|
-
|
|
|
- user_id = get_user_id(username)
|
|
|
- if (user_id == ""):
|
|
|
- // New user
|
|
|
- // Add user to Core Formalism
|
|
|
- user_id = instantiate_node(core, "User", "")
|
|
|
- instantiate_attribute(core, user_id, "name", username)
|
|
|
- instantiate_attribute(core, user_id, "admin", False)
|
|
|
-
|
|
|
- while (True):
|
|
|
+ while (True):
|
|
|
+ output("Log on as which user?")
|
|
|
+ username = input()
|
|
|
+
|
|
|
+ user_id = get_user_id(username)
|
|
|
+ if (user_id == ""):
|
|
|
+ // New user
|
|
|
+ // Add user to Core Formalism
|
|
|
+ user_id = instantiate_node(core, "User", "")
|
|
|
+ instantiate_attribute(core, user_id, "name", username)
|
|
|
+ instantiate_attribute(core, user_id, "admin", False)
|
|
|
+
|
|
|
output("This is a new user: please give password!")
|
|
|
password = hash(input())
|
|
|
|
|
|
output("Please repeat the password")
|
|
|
if (password == hash(input())):
|
|
|
- output("Passwords match!")
|
|
|
- output("User created")
|
|
|
instantiate_attribute(core, user_id, "password", password)
|
|
|
break!
|
|
|
else:
|
|
|
- output("Not the same password, please try again!")
|
|
|
+ output("Not the same password!")
|
|
|
+ else:
|
|
|
+ if (check_login(user_id)):
|
|
|
+ break!
|
|
|
+ else:
|
|
|
+ output("Wrong password!")
|
|
|
|
|
|
- // Now call with user created
|
|
|
- user_function_skip_init(user_id)
|
|
|
- else:
|
|
|
- while (bool_not(check_login(user_id))):
|
|
|
- output("Wrong password! Try again")
|
|
|
-
|
|
|
- user_function_skip_init(user_id)
|
|
|
+ user_function_skip_init(user_id)
|
|
|
|
|
|
// User destroyed already, so just stop execution
|
|
|
// TODO return a fresh node as otherwise the compiler doesn't take this
|