public bool CreateAccount(string login, string passwordHash, string email, string promocode) { Account existing = accountStorage.Load(login); if (existing != null) { return(false); } Account newAccount = new Account(); newAccount.id = HashUtil.FromString64(login); newAccount.login = login; newAccount.email = email; newAccount.passwordHash = passwordHash; newAccount.promoCode = promocode; newAccount.dateCreated = DateTime.Now; accountStorage.Store(newAccount); return(true); }
private void WndLoginClient(int id) { GUILayout.BeginArea(Rect.MinMaxRect(WndInset, 20, LoginWindowSize.x - WndInset, LoginWindowSize.y - WndInset)); if (!loginClient.isConnected) { if (GUILayout.Button("Start Login Client")) { loginClient.StartLoginClient(); } } else { GUILayout.Label("Connected: " + loginClient.isConnected); GUILayout.Label("Authorized: " + loginClient.isAuthorized); GUILayout.Label("Session ID: " + loginClient.sessionId); GUILayout.Height(15); if (showCreateAccount && !loginClient.isWatingForCreateAccountReply && !loginClient.isWaitingForAuthorizeReply) { GUILayout.Label("Create new account"); GUILayout.Label("Login"); login = GUILayout.TextField(login); GUILayout.Label("Password"); password = GUILayout.PasswordField(password, '*'); GUILayout.Label("Email"); email = GUILayout.TextField(email); GUILayout.Label("Promocode"); promoCode = GUILayout.TextField(promoCode); GUILayout.Height(15); if (GUILayout.Button("Register")) { loginClient.CreateAccount(login, HashUtil.HashPassword(password), email, promoCode); showCreateAccount = false; login = ""; password = ""; email = ""; promoCode = ""; } if (GUILayout.Button("Cancel")) { showCreateAccount = false; } } else if (loginClient.isWaitingForAuthorizeReply) { GUILayout.Label("Loggin in ... "); GUILayout.Button("Abort"); } else if (!loginClient.isAuthorized) { GUILayout.Label("Login"); login = GUILayout.TextField(login); GUILayout.Label("Password"); password = GUILayout.PasswordField(password, '*'); if (GUILayout.Button("Login")) { loginClient.Login(login, password); password = ""; } GUILayout.Height(15); if (GUILayout.Button("Register account")) { showCreateAccount = true; } } if (GUILayout.Button("Stop Login Client")) { loginClient.StopLoginClient(); } } GUILayout.EndArea(); GUI.DragWindow(Rect.MinMaxRect(0, 0, 10000, 20)); }
public static ulong MakeId(string value) { return(HashUtil.FromString64(value)); }
private void OnValidate() { precomputedAssetId = HashUtil.FromString64(assetNickname); }
public static int GetMessageCode(Type type) { return((int)HashUtil.FromString(type.FullName)); }