Ejemplo n.º 1
0
 public void sendSmsCode(int registerOrreset)
 {
     try{ VerifyCodeSettings settings = new VerifyCodeSettings.Builder()
                                        .action(registerOrreset)
                                        .sendInterval(30)
                                        .locale(Locale.CHINA)
                                        .build();
          HuaweiService.Task task = EmailAuthProvider.requestVerifyCode(email.text.Trim(), settings);
          task.addOnSuccessListener(TaskExecutors.uiThread(),
                                    new HuaweiOnsuccessListener <VerifyCodeResult>((codeResult) =>
         {
             PanelController.popupinstance.ShowInfo("code send successfully!");
         }))
          .addOnFailureListener(TaskExecutors.uiThread(), new HuaweiOnFailureListener((e) =>
         {
             Error error   = new Error();
             error.message = e.toString();
             PanelController.popupinstance.ShowError(error);
         })); }catch (System.Exception e)
     {
         Error error = new Error();
         error.message = e.Message;
         PanelController.popupinstance.ShowError(error);
     }
 }
Ejemplo n.º 2
0
        public void verify()
        {
            bool result = false;
            VerifyCodeSettings settings = new VerifyCodeSettings.Builder()
                                          .action(VerifyCodeSettings.ACTION_REGISTER_LOGIN)
                                          .sendInterval(30)
                                          .locale(Locale.CHINA)
                                          .build();

            HuaweiService.Task task = EmailAuthProvider.requestVerifyCode(emailorPhone.text, settings);
            task.addOnSuccessListener(TaskExecutors.uiThread(),
                                      new HuaweiOnsuccessListener <VerifyCodeResult>(
                                          (codeResult) =>
            {
                result = true;
                UnityMainThread.instance.AddJob(() =>
                {
                    PanelController.popupinstance.ShowInfo("sms code send successfully!");
                });
            }))
            .addOnFailureListener(TaskExecutors.uiThread(), new HuaweiOnFailureListener((e) =>
            {
                UnityMainThread.instance.AddJob(() =>
                {
                    Error error   = new Error();
                    error.message = e.toString();
                    PanelController.popupinstance.ShowError(error);
                });
            }));
        }
Ejemplo n.º 3
0
 public void phoneVerify(string phoneNumber, string countryCodeStr, int registerOrreset)
 {
     try
     {
         settings = GenerateSettings(registerOrreset);
         HuaweiService.Task task = PhoneAuthProvider.requestVerifyCode(countryCodeStr, phoneNumber, settings);
         task.addOnSuccessListener(TaskExecutors.uiThread(),
                                   new HuaweiOnsuccessListener <VerifyCodeResult>((codeResult) =>
         {
             UnityMainThread.instance.AddJob(() =>
             {
                 PanelController.popupinstance.ShowInfo("sms code send successfully!");
                 infoMessage.text = "sms code send successfully!";
             });
         }))
         .addOnFailureListener(TaskExecutors.uiThread(), new HuaweiOnFailureListener((e) =>
         {
             UnityMainThread.instance.AddJob(() =>
             {
                 Error error   = new Error();
                 error.message = e.toString();
                 PanelController.popupinstance.ShowError(error);
                 infoMessage.text = e.toString();
             });
         }));
     }catch (System.Exception e)
     {
         Error error = new Error();
         error.message = e.Message;
         PanelController.popupinstance.ShowError(error);
     }
 }
Ejemplo n.º 4
0
        public void verify(int resetOrregister)
        {
            VerifyCodeSettings settings = new VerifyCodeSettings.Builder()
                                          .action(resetOrregister)
                                          .sendInterval(30)
                                          .locale(Locale.CHINA)
                                          .build();

            if (isPhoneOrEmail)
            {
                task = EmailAuthProvider.requestVerifyCode(isModifyPassword?emailorPhone.text.Trim():newemailorPhoneorpassword.text.Trim(), settings);
            }
            else
            {
                task = PhoneAuthProvider.requestVerifyCode("+86", isModifyPassword?emailorPhone.text.Trim():newemailorPhoneorpassword.text.Trim(), settings);
            }

            task.addOnSuccessListener(TaskExecutors.uiThread(),
                                      new HuaweiOnsuccessListener <VerifyCodeResult>(
                                          (codeResult) =>
            {
                showMessage.text = "code send successfully!";
                PanelController.popupinstance.ShowInfo("code send successfully!");
            }))
            .addOnFailureListener(TaskExecutors.uiThread(), new HuaweiOnFailureListener((e) =>
            {
                Error error   = new Error();
                error.message = e.toString();
                PanelController.popupinstance.ShowError(error);
                showMessage.text = e.toString();
            }));
        }
Ejemplo n.º 5
0
 public void OnModifyClick()
 {
     instance      = AGConnectAuth.getInstance();
     agConnectUser = instance.getCurrentUser();
     if (agConnectUser != null)
     {
         try
         {
             if (!isModifyPassword)
             {
                 if (isPhoneOrEmail)
                 {
                     modifyTask = agConnectUser
                                  .updateEmail(newemailorPhoneorpassword.text.Trim(), verifyCode.text.Trim());
                 }
                 else
                 {
                     modifyTask = agConnectUser
                                  .updatePhone("+86", newemailorPhoneorpassword.text.Trim(), verifyCode.text.Trim());
                 }
             }
             else
             {
                 modifyTask = agConnectUser.updatePassword(
                     newemailorPhoneorpassword.text.Trim(),
                     verifyCode.text.Trim(),
                     isPhoneOrEmail
                         ? AGConnectAuthCredential.Email_Provider
                         : AGConnectAuthCredential.Phone_Provider);
             }
             modifyTask.addOnSuccessListener(new HuaweiOnsuccessListener <SignInResult>((signresult) =>
             {
                 PanelController.popupinstance.ShowInfo("modify successfully!");
                 showMessage.text = "modify successfully!";
                 PanelController.getInstance().OpenPanel(PanelController.userInfo);
             })).addOnFailureListener(new HuaweiOnFailureListener((e
                                                                   ) =>
             {
                 Error error   = new Error();
                 error.message = e.toString();
                 PanelController.popupinstance.ShowError(error);
                 showMessage.text = e.toString();
             }));
         }
         catch (System.Exception e)
         {
             Error error = new Error();
             error.message    = e.Message;
             showMessage.text = e.Message;
             PanelController.popupinstance.ShowError(error);
         }
     }
     else
     {
         showMessage.text = "User is null!";
     }
 }
 public void onVerifyButtonClick()
 {
     settings = GenerateSettings(VerifyCodeSettings.ACTION_REGISTER_LOGIN);
     HuaweiService.Task task = PhoneAuthProvider.requestVerifyCode(regionText, emailorPhone.text, settings);
     task.addOnSuccessListener(TaskExecutors.uiThread(),
                               new HuaweiOnsuccessListener <VerifyCodeResult>((codeResult) =>
     {
         PanelController.popupinstance.ShowInfo("sms code send successfully!");
     }))
     .addOnFailureListener(TaskExecutors.uiThread(), new HuaweiOnFailureListener((e) =>
     {
         Error error   = new Error();
         error.message = e.toString();
         PanelController.popupinstance.ShowError(error);
     }));
 }