public async Task <IActionResult> OrderComplete(string planNumber)
        {
            var amount = 860; // Usually this comes from DB.

            var loginApi = new LoginApi(this.FlexFieldsEnv);
            var request  = new LoginRequest(userName: SplititApiUsername, password: SplititApiPassword);

            var loginResult = await loginApi.LoginPostAsync(request);

            var installmentPlanApi    = new InstallmentPlanApi(this.FlexFieldsEnv, sessionId: loginResult.SessionId);
            var verifyPaymentResponse = installmentPlanApi.InstallmentPlanVerifyPayment(new VerifyPaymentRequest()
            {
                InstallmentPlanNumber = planNumber
            });

            if (verifyPaymentResponse.IsPaid == true && verifyPaymentResponse.OriginalAmountPaid == amount)
            {
                return(View(new OrderCompleteModel()
                {
                    Ok = true
                }));
            }
            else
            {
                return(View(new OrderCompleteModel()
                {
                    Ok = false
                }));
            }
        }
예제 #2
0
        public async Task <IActionResult> Login([FromBody] LoginApi apiModel)
        {
            Result <string> result;

            if (ModelState.IsValid)
            {
                var signInResult = await _signInManager.PasswordSignInAsync(apiModel.EmailAddress, apiModel.Password, apiModel.IsRemember, lockoutOnFailure : false);

                if (signInResult.Succeeded)
                {
                    ApiHelpers helper = new ApiHelpers(_userManager, _signInManager);
                    result = new Result <string>(await helper.GenerateToken(apiModel.EmailAddress));
                }
                else
                {
                    result = new Result <string>(false, ResultTypeEnum.Error, "An error occured while login request. Please check the informations!");
                }
            }
            else
            {
                result = new Result <string>(false, ResultTypeEnum.Error, "An error occured while login request. complete all validations!");
            }

            return(Json(result));
        }
예제 #3
0
        public async Task <IActionResult> TokenAsync([FromBody] LoginApi model)
        {
            if (ModelState.IsValid)
            {
                var result = await signInManager.PasswordSignInAsync(model.Login, model.Password, true, true);

                if (result.Succeeded)
                {//criar token (header + payload>> claims(direitos) + signature)
                    var claims = new[]
                    {
                        new Claim(JwtRegisteredClaimNames.Sub, model.Login),
                        new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString())
                    };
                    var chave       = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("rlb-webapi-authentication-validation"));
                    var credenciais = new SigningCredentials(chave, SecurityAlgorithms.HmacSha256);

                    var token = new JwtSecurityToken(
                        issuer: "App.RLB.WebAPI",
                        audience: "Swagger",
                        claims: claims,
                        signingCredentials: credenciais,
                        expires: DateTime.Now.AddMinutes(30)
                        );

                    return(Ok(new JwtSecurityTokenHandler().WriteToken(token)));
                }
                return(Unauthorized());//401
            }
            return(Ok());
        }
예제 #4
0
 static void fetchInitData()
 {
     LoginApi.InitData().Then(initDataResponse => {
         var vs           = initDataResponse.VS;
         var serverConfig = initDataResponse.config;
         if (vs.isNotEmpty())
         {
             HttpManager.updateCookie($"VS={vs}");
         }
         if (serverConfig.tinyGameUrl.isNotEmpty())
         {
             LocalDataManager.saveTinyGameUrl(url: serverConfig.tinyGameUrl);
         }
         if (serverConfig.minVersionCode.isNotEmpty())
         {
             if (!int.TryParse(serverConfig.minVersionCode, out var minVersionCode))
             {
                 return;
             }
             if (minVersionCode > 0 && minVersionCode > Config.versionCode)
             {
                 // need update
                 StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushToAction {
                     routeName = MainNavigatorRoutes.ForceUpdate
                 });
                 VersionManager.saveMinVersionCode(versionCode: minVersionCode);
             }
         }
     }).Catch(exception => {
         StoreProvider.store.dispatcher.dispatch(new NetworkAvailableStateAction {
             available = false
         });
         Debuger.LogError(message: exception);
     });
 }
예제 #5
0
 public static object loginByWechat(string code)
 {
     return(new ThunkAction <AppState>((dispatcher, getState) => {
         return LoginApi.LoginByWechat(code)
         .Then(loginInfo => {
             var user = new User {
                 id = loginInfo.userId,
                 fullName = loginInfo.userFullName,
                 avatar = loginInfo.userAvatar,
                 title = loginInfo.title,
                 coverImage = loginInfo.coverImageWithCDN
             };
             var dict = new Dictionary <string, User> {
                 { user.id, user }
             };
             dispatcher.dispatch(new UserMapAction {
                 userMap = dict
             });
             dispatcher.dispatch(new LoginByWechatSuccessAction {
                 loginInfo = loginInfo
             });
             UserInfoManager.saveUserInfo(loginInfo);
             AnalyticsManager.LoginEvent("wechat");
             AnalyticsManager.AnalyticsLogin("wechat", loginInfo.userId);
             JPushPlugin.setJPushAlias(loginInfo.userId);
         });
     }));
 }
예제 #6
0
        private async void OnLoginClick(object sender, EventArgs e)
        {
            if (ValidationCompleted())
            {
                LoginApi Login = new LoginApi();
                //try
                //{
                bool res = await Login.LoginUserDetails(Email.Text, Password.Text);

                if (res)
                {
                    await DisplayAlert("Welcome", "Login successful...", "Okay");

                    await Navigation.PushModalAsync(new MasterDetail());
                }
                //if (Email.Text == "*****@*****.**" && Password.Text == "Default_pass")

                //{
                //    await Navigation.PushModalAsync(new LandingPage());
                //}
                else
                {
                    await DisplayAlert("Error", "Invalid Login, try again", "OK");
                }
                //}
                //catch(Exception ex)
                //{
                //    await DisplayAlert("Error", ex.Message + ex.StackTrace, "OK");

                //}
            }
        }
예제 #7
0
        public static void initVSCode()
        {
            LoginApi.InitData().Then(initDataResponse => {
                if (initDataResponse.VS.isNotEmpty())
                {
                    vsCookie = $"VS={initDataResponse.VS}";
                    updateCookie(newCookie: vsCookie);
                }

                var firstEgg = false;
                var scan     = false;
                if (initDataResponse.config != null)
                {
                    if (initDataResponse.config.eggs != null && initDataResponse.config.eggs.ContainsKey("firstEgg"))
                    {
                        firstEgg = initDataResponse.config.eggs["firstEgg"];
                    }

                    scan = initDataResponse.config.scan;
                }

                if (initDataResponse.showEggs.isNotEmpty())
                {
                    StoreProvider.store.dispatcher.dispatch(new InitEggsAction {
                        firstEgg = firstEgg
                    });
                }

                StoreProvider.store.dispatcher.dispatch(new ScanEnabledAction {
                    scanEnabled = scan
                });
            }).Catch(exception => { });
        }
        public async Task <JsonResult> AjaxInitiate(
            decimal amount, int?numInstallments = null, bool?secure3d = false, bool?autoCapture = null,
            int numOptions = 6, bool pascalCase = false)
        {
            var billingAddress = new AddressData();
            var consumerModel  = new ConsumerData(isLocked: false, isDataRestricted: false);

            await this.TryUpdateModelAsync(billingAddress, "billingAddress");

            await this.TryUpdateModelAsync(consumerModel, "consumerModel");

            var loginApi = new LoginApi(this.FlexFieldsEnv);
            var request  = new LoginRequest(userName: SplititApiUsername, password: SplititApiPassword);

            var loginResult = await loginApi.LoginPostAsync(request);

            var installmentPlanApi = new InstallmentPlanApi(this.FlexFieldsEnv, sessionId: loginResult.SessionId);
            var initResponse       = installmentPlanApi.InstallmentPlanInitiate(new InitiateInstallmentPlanRequest()
            {
                PlanData = new PlanData(
                    amount: new MoneyWithCurrencyCode(amount, "USD"),
                    numberOfInstallments: numInstallments,
                    attempt3DSecure: secure3d,
                    autoCapture: autoCapture),
                BillingAddress    = billingAddress,
                ConsumerData      = consumerModel,
                PaymentWizardData = new PaymentWizardData(
                    requestedNumberOfInstallments: string.Join(",", Enumerable.Range(1, numOptions)))
            });

            return(new JsonResult(initResponse));
        }
예제 #9
0
        /// <exception cref="WebApiClientException"></exception>
        public bool Verify(string username, string password)
        {
            ILoginApi loginEngine = new LoginApi();

            loginEngine.Login(username, password, true);
            return(loginEngine.User != null);
        }
예제 #10
0
 public static object loginByQr(string token, string action)
 {
     return(new ThunkAction <AppState>((dispatcher, getState) => {
         return LoginApi.LoginByQr(token: token, action: action)
         .Then(success => {
             if (action != "confirm")
             {
                 return;
             }
             CustomDialogUtils.hiddenCustomDialog();
             dispatcher.dispatch(new MainNavigatorPopAction());
             CustomDialogUtils.showToast(
                 success ? "扫码成功" : "扫码失败",
                 success ? Icons.sentiment_satisfied : Icons.sentiment_dissatisfied
                 );
         })
         .Catch(error => {
             if (action != "confirm")
             {
                 return;
             }
             CustomDialogUtils.hiddenCustomDialog();
             dispatcher.dispatch(new MainNavigatorPopAction());
             CustomDialogUtils.showToast("扫码失败", iconData: Icons.sentiment_dissatisfied);
         });
     }));
 }
예제 #11
0
        /// <exception cref="WebApiClientException"></exception>
        public void Login(string username, string password)
        {
            ILoginApi loginEngine = new LoginApi();

            loginEngine.Login(username, password);
            LoginMessage = loginEngine.Message;
            UserSigned   = loginEngine.User;
            if (IsLoginSuccessful)
            {
                try
                {
                    System.IO.File.WriteAllLines(
                        Constants.AuthenticationRecordFile,
                        new string[]
                    {
                        UserSigned.Id,
                        UserSigned.EmailAddress,
                        UserSigned.PasswordHash,
                        UserSigned.RegistrationTimestamp.ToString()
                    }
                        );
                }
                catch (Exception e)
                {
                    string a = e.Message;
                }
            }
        }
예제 #12
0
        public void LoginTest_ShouldFalse()
        {
            // Setup the handler
            var mockHandler = GetHttpMessageHandlerMock("Invalid Username or Password.");

            // Use HttpClient with mocked HttpMessageHandler
            var httpClient = new HttpClient(mockHandler.Object);

            var objectToTest = new LoginApi(new Uri("https://test.com/"), ref httpClient);

            // Perform test
            var user = "******";
            var pass = "******";

            objectToTest.LoginAsync(user, pass).Result.Should().Be(false);
            objectToTest.IsLoggedIn.Should().Be(false);

            // Check the http call was as expected
            var expectedUri   = new Uri("https://test.com/cgi/session.pl");
            var formVariables = new List <KeyValuePair <string, string> >(3);

            formVariables.Add(new KeyValuePair <string, string>(".submit", "Sign+in"));
            formVariables.Add(new KeyValuePair <string, string>("user_id", user));
            formVariables.Add(new KeyValuePair <string, string>("password", pass));
            var expectedContent = new FormUrlEncodedContent(formVariables);

            VerifyMockCalls(mockHandler, HttpMethod.Post, expectedUri, expectedContent);
        }
예제 #13
0
        /// <summary>
        /// 直播间状态检查
        /// </summary>
        /// <returns></returns>
        private static async Task <bool> LiveRoomStateCheck(User user)
        {
            try
            {
                string info = await LoginApi.GetInfoAsync(user);

                if (string.IsNullOrEmpty(info))
                {
                    if (!await user.Login())
                    {
                        throw new Exception("User login failed. exit.");
                    }
                }
                LiveRoomStreamDataInfo roomInfo = await LiveApi.GetRoomInfo(user);

                if (roomInfo == null)
                {
                    return(false);
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }
예제 #14
0
        static void addListener()
        {
            if (Application.isEditor)
            {
                return;
            }

            if (!isListen)
            {
                isListen = true;
                UIWidgetsMessageManager.instance.AddChannelMessageDelegate("QRScan", del: _handleMethodCall);
                if (_loginSubId.isNotEmpty())
                {
                    EventBus.unSubscribe(sName: EventBusConstant.login_success, id: _loginSubId);
                }
                _loginSubId = EventBus.subscribe(sName: EventBusConstant.login_success, args => {
                    if (qrCodeToken.isNotEmpty())
                    {
                        LoginApi.LoginByQr(token: qrCodeToken, "check");
                        StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushToQRScanLoginAction {
                            token = qrCodeToken
                        });
                        qrCodeToken = null;
                    }
                });
            }
        }
예제 #15
0
 static void checkToken(string token)
 {
     CustomDialogUtils.showCustomDialog(
         child: new CustomLoadingDialog(
             message: "验证中"
             )
         );
     LoginApi.LoginByQr(token: token, "check").Then(success => {
         CustomDialogUtils.hiddenCustomDialog();
         StoreProvider.store.dispatcher.dispatch(
             new MainNavigatorPushToQRScanLoginAction {
             token = token
         }
             );
         CustomDialogUtils.showToast("验证成功", iconData: Icons.sentiment_satisfied);
         AnalyticsManager.AnalyticsQRScan(state: QRState.check);
     }).Catch(error => {
         CustomDialogUtils.hiddenCustomDialog();
         CustomDialogUtils.showToast("验证失败", iconData: Icons.sentiment_dissatisfied);
         Promise.Delayed(new TimeSpan(0, 0, 1))
         .Then(() => {
             PushToQRScan();
             AnalyticsManager.AnalyticsQRScan(state: QRState.check, false);
         });
     });
 }
예제 #16
0
 public static object loginByEmail()
 {
     return(new ThunkAction <AppState>((dispatcher, getState) => {
         var email = getState().loginState.email;
         var password = getState().loginState.password;
         return LoginApi.LoginByEmail(email, password)
         .Then(loginInfo => {
             var user = new User {
                 id = loginInfo.userId,
                 fullName = loginInfo.userFullName,
                 avatar = loginInfo.userAvatar,
                 title = loginInfo.title,
                 coverImage = loginInfo.coverImageWithCDN
             };
             var dict = new Dictionary <string, User> {
                 { user.id, user }
             };
             dispatcher.dispatch(new UserMapAction {
                 userMap = dict
             });
             dispatcher.dispatch(new LoginByEmailSuccessAction {
                 loginInfo = loginInfo
             });
             dispatcher.dispatch(new MainNavigatorPopAction());
             dispatcher.dispatch(new CleanEmailAndPasswordAction());
             UserInfoManager.saveUserInfo(loginInfo);
             AnalyticsManager.LoginEvent("email");
             AnalyticsManager.AnalyticsLogin("email", loginInfo.userId);
             JPushPlugin.setJPushAlias(loginInfo.userId);
         });
     }));
 }
예제 #17
0
 public LoginData(LoginApi data)
 {
     Username             = data.Username;
     Password             = data.Password;
     PasswordRevisionDate = data.PasswordRevisionDate;
     Totp = data.Totp;
     Uris = data.Uris?.Select(u => new LoginUriData(u)).ToList();
 }
예제 #18
0
        public void LoginViaApi(User user)
        {
            var token = new Token(Driver.Manage().Cookies.GetCookieNamed("PHPSESSID").Value);

            LoginApi.Login(user, token);
            MyDriver.SetCookies(Driver);
            Driver.Url = "https://s2.demo.opensourcecms.com/orangehrm/index.php";
        }
예제 #19
0
        /// <exception cref="WebApiClientException"></exception>
        private string RegisterAutologin(string username, string password)
        {
            ILoginApi loginEngine = new LoginApi();

            loginEngine.Login(username, password);
            LoginMessage = loginEngine.Message;
            UserSigned   = loginEngine.User;
            return(loginEngine.Token);
        }
예제 #20
0
 public static object openCreateUnityIdUrl()
 {
     return(new ThunkAction <AppState>((dispatcher, getState) => {
         return LoginApi.FetchCreateUnityIdUrl()
         .Then(url => { dispatcher.dispatch(new OpenUrlAction {
                 url = url
             }); });
     }));
 }
예제 #21
0
        public void Login2(User user)
        {
            var token = LoginApi.Login(user);

            Driver.Manage().Cookies.AddCookie(new Cookie("PHPSESSID", token.PHPSESSID));
            Driver.Manage().Cookies.AddCookie(new Cookie("Loggedin", "True"));
            Driver.Url = "https://s2.demo.opensourcecms.com/orangehrm/index.php";
            MyDriver.WriteAllCookies(Driver);
        }
예제 #22
0
        // Authenticate with the api
        void Login(string username, string password)
        {
            var loginApi = new LoginApi(Configuration.Sandbox);
            var request  = new LoginRequest(userName: username, password: password);

            var loginResult = loginApi.LoginPost(request);

            PlanApi = new InstallmentPlanApi(Configuration.Sandbox, sessionId: loginResult.SessionId);
        }
예제 #23
0
 static void _handleMethodCall(string method, List <JSONNode> args)
 {
     if (context != null)
     {
         using (WindowProvider.of(context: context).getScope()) {
             switch (method)
             {
             case "OnReceiveQRCode": {
                 string qrCode = args[0];
                 if (qrCode.StartsWith("http://") || qrCode.StartsWith("https://"))
                 {
                     var uri = new Uri(uriString: qrCode);
                     if (uri.AbsoluteUri.StartsWith("https://connect"))
                     {
                         var token = HttpUtility.ParseQueryString(query: uri.Query).Get("token");
                         if (token.isNotEmpty())
                         {
                             var isLoggedIn = StoreProvider.store.getState().loginState.isLoggedIn;
                             if (isLoggedIn)
                             {
                                 LoginApi.LoginByQr(token: token, "check");
                                 StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushToQRScanLoginAction {
                                         token = token
                                     });
                             }
                             else
                             {
                                 qrCodeToken = token;
                                 StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushToAction {
                                         routeName = MainNavigatorRoutes.Login
                                     });
                             }
                         }
                         else
                         {
                             StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushToWebViewAction {
                                     url = qrCode
                                 });
                         }
                     }
                     else
                     {
                         StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushToWebViewAction {
                                 url = qrCode
                             });
                     }
                 }
                 StatusBarManager.hideStatusBar(false);
                 StatusBarManager.statusBarStyle(false);
                 removeListener();
             }
             break;
             }
         }
     }
 }
예제 #24
0
 public static void initVSCode()
 {
     LoginApi.InitData().Then(code => {
         if (code.isNotEmpty())
         {
             vsCookie = $"VS={code}";
             updateCookie(vsCookie);
         }
     }).Catch(exception => { });
 }
예제 #25
0
 void ConnectionOpened(Response response)
 {
     Unity.Console.DebugLog("ApiManager class", Unity.Console.SetMagentaColor("Regular Callback:"), "ConnectionOpened()");
     InitializeApi(LoginApi.Create(this));
     response.SendResultData <string>(url => {
         if (OnConnectionOpened != null)
         {
             OnConnectionOpened.Invoke(url);
         }
     });
 }
예제 #26
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var user            = this.user.Text;
            var employeeAccount = this.employeeAccount.Text;
            var pwd             = this.pwd.Text;
            var code            = this.code.Text;

            LoginApi.Login(user, employeeAccount, pwd, code);

            Thread.Sleep(1000);

            ViewModels.ViewModelLoctor.CallNumberViewModel.AddTableModels(TableStatusApi.TableQuery <ObservableCollection <TableModel> >());
        }
예제 #27
0
        private static async Task Main(string[] args)
        {
            if (args == null || args.Length == 0)
            {
                Console.WriteLine($"Usage: {nameof(SearcherWebClient)} \"query\" [\"Market1[,Market2[,...]]\" [size]] ");
                return;
            }

            // parse arguments
            var query          = args[0];
            var markets        = args.Length > 1 ? args[1].ParseMarkets().ToList() : null;
            var size           = args.Length > 2 ? ParseSize(args[2]) : (int?)null;
            var searchQueryDto = new SearchQueryDto(query, markets, size);

            // login
            var loginApi    = new LoginApi(BasePath);
            var loginResult = await loginApi.LoginAsync(new UserLoginDto("user", "qwerty"));

            if (!string.IsNullOrEmpty(loginResult.ErrorMessage))
            {
                Console.WriteLine($"Login error: {loginResult.ErrorMessage}");
                return;
            }

            Console.WriteLine($"Login as {loginResult.User.Login} (id={loginResult.User.Id}) is successful");

            // search
            var searchApi = new SearchApi(BasePath)
            {
                Configuration =
                {
                    DefaultHeader = new Dictionary <string, string> {
                        { "Authorization", "Bearer " + loginResult.Token }
                    }
                }
            };
            var foundItems = await searchApi.SearchAsync(searchQueryDto);

            // show results
            foreach (var item in foundItems)
            {
                var sb = new StringBuilder($"{item.Id} ({item.ItemType}): {item.Name}");
                if (!string.IsNullOrEmpty(item.FormerName))
                {
                    sb.Append($" ({item.FormerName})");
                }

                sb.Append($" {item.Address}");
                Console.WriteLine(sb.ToString());
            }
        }
예제 #28
0
 static void fetchInitData()
 {
     LoginApi.InitData().Then(initDataResponse => {
         if (initDataResponse.VS.isNotEmpty())
         {
             HttpManager.updateCookie($"VS={initDataResponse.VS}");
         }
     }).Catch(exception => {
         StoreProvider.store.dispatcher.dispatch(new NetworkAvailableStateAction {
             available = false
         });
         Debuger.LogError(message: exception);
     });
 }
예제 #29
0
 public static object loginByWechat(string code)
 {
     return(new ThunkAction <AppState>((dispatcher, getState) => {
         return LoginApi.LoginByWechat(code: code)
         .Then(loginInfo => {
             CustomDialogUtils.hiddenCustomDialog();
             var user = new User {
                 id = loginInfo.userId,
                 fullName = loginInfo.userFullName,
                 avatar = loginInfo.userAvatar,
                 title = loginInfo.title,
                 coverImage = loginInfo.coverImageWithCDN
             };
             var dict = new Dictionary <string, User> {
                 { user.id, user }
             };
             dispatcher.dispatch(new UserMapAction {
                 userMap = dict
             });
             dispatcher.dispatch(new LoginByWechatSuccessAction {
                 loginInfo = loginInfo
             });
             dispatcher.dispatch(fetchChannels(1));
             dispatcher.dispatch(fetchCreateChannelFilter());
             UserInfoManager.saveUserInfo(loginInfo);
             AnalyticsManager.LoginEvent("wechat");
             AnalyticsManager.AnalyticsLogin("wechat", loginInfo.userId);
             JPushPlugin.setJPushAlias(loginInfo.userId);
             if (loginInfo.anonymous)
             {
                 LoginScreen.navigator.pushReplacementNamed(routeName: LoginNavigatorRoutes
                                                            .WechatBindUnity);
             }
             else
             {
                 dispatcher.dispatch(new MainNavigatorPopAction());
                 EventBus.publish(sName: EventBusConstant.login_success,
                                  new List <object> {
                     loginInfo.userId
                 });
             }
         })
         .Catch(error => {
             CustomDialogUtils.hiddenCustomDialog();
             dispatcher.dispatch(new LoginByWechatFailureAction());
         });
     }));
 }
예제 #30
0
 public static object loginByEmail()
 {
     return(new ThunkAction <AppState>((dispatcher, getState) => {
         var email = getState().loginState.email;
         var password = getState().loginState.password;
         return LoginApi.LoginByEmail(email: email, password: password)
         .Then(loginInfo => {
             var user = new User {
                 id = loginInfo.userId,
                 fullName = loginInfo.userFullName,
                 avatar = loginInfo.userAvatar,
                 title = loginInfo.title,
                 coverImage = loginInfo.coverImageWithCDN
             };
             var dict = new Dictionary <string, User> {
                 { user.id, user }
             };
             dispatcher.dispatch(new UserMapAction {
                 userMap = dict
             });
             dispatcher.dispatch(new LoginByEmailSuccessAction {
                 loginInfo = loginInfo
             });
             dispatcher.dispatch(fetchChannels(1));
             dispatcher.dispatch(fetchCreateChannelFilter());
             dispatcher.dispatch <IPromise>(fetchUserProfile(loginInfo.userId));
             dispatcher.dispatch(new CleanEmailAndPasswordAction());
             UserInfoManager.saveUserInfo(loginInfo);
             AnalyticsManager.LoginEvent("email");
             AnalyticsManager.AnalyticsLogin("email", loginInfo.userId);
             JPushPlugin.setJPushAlias(loginInfo.userId);
             BuglyAgent.SetUserId(loginInfo.userId);
             EventBus.publish(sName: EventBusConstant.login_success, new List <object> {
                 loginInfo.userId
             });
             dispatcher.dispatch(new MainNavigatorPopAction());
         })
         .Catch(error => {
             dispatcher.dispatch(new LoginByEmailFailureAction());
             Debuger.LogError(message: error);
             var customSnackBar = new CustomSnackBar(
                 "登录失败,请重试。"
                 );
             customSnackBar.show();
         });
     }));
 }