Example #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);
     }
 }
Example #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);
                });
            }));
        }
        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();
            }));
        }
    public void RequestVerifyCodeWithEmail()
    {
        VerifyCodeSettings verifyCodeSettings = new VerifyCodeSettings.Builder()
                                                .Action(VerifyCodeSettings.ACTION_REGISTER_LOGIN)
                                                .Locale(Locale.GetDefault())
                                                .SendInterval(30).Build();

        EmailAuthProvider.RequestVerifyCode(EmailAddress.text, verifyCodeSettings)
        .AddOnSuccessListener(result => {
            verifyCodeEmail.SetActive(true);
        })
        .AddOnFailureListener(error => {
            loggedInUser.text = error.WrappedExceptionMessage;
        });
    }
    public void RequestVerifyCodeWithPhoneNumber()
    {
        VerifyCodeSettings verifyCodeSettings = new VerifyCodeSettings.Builder()
                                                .Action(VerifyCodeSettings.ACTION_REGISTER_LOGIN)
                                                .Locale(Locale.GetDefault())
                                                .SendInterval(30).Build();

        PhoneAuthProvider.RequestVerifyCode(PhoneCountryCode.text, PhoneNumber.text, verifyCodeSettings)
        .AddOnSuccessListener(verifyCodeResult => {
            verifyCodePhone.SetActive(true);
        })
        .AddOnFailureListener(exception => {
            loggedInUser.text = exception.WrappedExceptionMessage;
        });
    }