Пример #1
0
 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");
     }
 }
Пример #2
0
 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");
     }
 }
Пример #3
0
    //入力されたユーザ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);
    }
Пример #4
0
 public void Test_0313_isValidPassword_space()
 {
     Assert.IsTrue(KiiUser.IsValidPassword("ab c"));
 }
Пример #5
0
 public void Test_0312_isValidPassword_multibyte_space()
 {
     Assert.IsFalse(KiiUser.IsValidPassword("abc "));
 }
Пример #6
0
 public void Test_0311_isValidPassword_multibyte()
 {
     Assert.IsFalse(KiiUser.IsValidPassword("abcKii"));
 }
Пример #7
0
 public void Test_0310_isValidPassword_u007F()
 {
     Assert.IsFalse(KiiUser.IsValidPassword("abc\u007F"));
 }
Пример #8
0
 public void Test_0309_isValidPassword_u007E()
 {
     Assert.IsTrue(KiiUser.IsValidPassword("abc\u007E"));
 }
Пример #9
0
 public void Test_0301_isValidPassword_null()
 {
     Assert.IsFalse(KiiUser.IsValidPassword(null));
 }
Пример #10
0
 public void Test_0307_isValidPassword_u0019()
 {
     Assert.IsFalse(KiiUser.IsValidPassword("abc\u0019"));
 }
Пример #11
0
 public void Test_0306_isValidPassword_mark()
 {
     Assert.IsTrue(KiiUser.IsValidPassword("abc.d"));
 }
Пример #12
0
 public void Test_0305_isValidPassword_len51()
 {
     Assert.IsFalse(KiiUser.IsValidPassword(NUMBER_50 + "1"));
 }
Пример #13
0
 public void Test_0304_isValidPassword_len50()
 {
     Assert.IsTrue(KiiUser.IsValidPassword(NUMBER_50));
 }
Пример #14
0
 public void Test_0303_isValidPassword_len4()
 {
     Assert.IsTrue(KiiUser.IsValidPassword("abcd"));
 }
Пример #15
0
 public void Test_0302_isValidPassword_len3()
 {
     Assert.IsFalse(KiiUser.IsValidPassword("abc"));
 }
Пример #16
0
 public void Test_0308_isValidPassword_u0020()
 {
     Assert.IsTrue(KiiUser.IsValidPassword("abc\u0020"));
 }
Пример #17
0
 public void Test_0300_isValidPassword_OK()
 {
     Assert.IsTrue(KiiUser.IsValidPassword("123ABC"));
 }