static public void Login(string username, string password, bool autoLogin) { if (KiiUser.IsValidUserName(username) && KiiUser.IsValidPassword(password)) { LoginUI.instance.Wait(); KiiUser.LogIn(username, password, (KiiUser loginedUser, Exception e) => { LoginUI.instance.StopWait(); if (e == null) { PlayerPrefs.SetInt("auto login", autoLogin ? 1 : 0); PlayerPrefs.SetString("access token", KiiUser.AccessToken); LoginUI.instance.OnLoginSuccess(); } else { HandlerLoginException(e); } }); } else { LoginUI.instance.ShowMessage("Invalid username or password"); } }
static public void Signup(string username, string password, string displayName, bool autoLogin) { //先在客户端检查是否合法 if (KiiUser.IsValidUserName(username) && KiiUser.IsValidPassword(password) && KiiUser.IsValidDisplayName(displayName)) { KiiUser.Builder userBuilder = KiiUser.BuilderWithName(username); KiiUser user = userBuilder.Build(); user.Displayname = displayName; LoginUI.instance.Wait(); user.Register(password, (KiiUser registeredUser, Exception e) => { LoginUI.instance.StopWait(); if (e == null) { PlayerPrefs.SetInt("auto login", autoLogin ? 1 : 0); PlayerPrefs.SetString("access token", KiiUser.AccessToken); LoginUI.instance.OnLoginSuccess(); } //处理异常 else { HandlerLoginException(e); } }); } else { LoginUI.instance.ShowMessage("Invalid name or password"); } }
//入力されたユーザID、パスワードのユーザが存在しなければ新規作成 public bool RegistUser(string userName, string password) { if (!KiiUser.IsValidUserName(userName) || !KiiUser.IsValidPassword(password)) { Debug.LogError("Invalid user name or password : "******"Success user regist : " + userName); } catch (System.Exception exception) { Debug.Log("Failed user regist : " + userName + " : " + exception); _User = null; return(false); } return(true); }
public void Test_0313_isValidPassword_space() { Assert.IsTrue(KiiUser.IsValidPassword("ab c")); }
public void Test_0312_isValidPassword_multibyte_space() { Assert.IsFalse(KiiUser.IsValidPassword("abc ")); }
public void Test_0311_isValidPassword_multibyte() { Assert.IsFalse(KiiUser.IsValidPassword("abcKii")); }
public void Test_0310_isValidPassword_u007F() { Assert.IsFalse(KiiUser.IsValidPassword("abc\u007F")); }
public void Test_0309_isValidPassword_u007E() { Assert.IsTrue(KiiUser.IsValidPassword("abc\u007E")); }
public void Test_0301_isValidPassword_null() { Assert.IsFalse(KiiUser.IsValidPassword(null)); }
public void Test_0307_isValidPassword_u0019() { Assert.IsFalse(KiiUser.IsValidPassword("abc\u0019")); }
public void Test_0306_isValidPassword_mark() { Assert.IsTrue(KiiUser.IsValidPassword("abc.d")); }
public void Test_0305_isValidPassword_len51() { Assert.IsFalse(KiiUser.IsValidPassword(NUMBER_50 + "1")); }
public void Test_0304_isValidPassword_len50() { Assert.IsTrue(KiiUser.IsValidPassword(NUMBER_50)); }
public void Test_0303_isValidPassword_len4() { Assert.IsTrue(KiiUser.IsValidPassword("abcd")); }
public void Test_0302_isValidPassword_len3() { Assert.IsFalse(KiiUser.IsValidPassword("abc")); }
public void Test_0308_isValidPassword_u0020() { Assert.IsTrue(KiiUser.IsValidPassword("abc\u0020")); }
public void Test_0300_isValidPassword_OK() { Assert.IsTrue(KiiUser.IsValidPassword("123ABC")); }