示例#1
0
        void HandleLoginResult(Task <MobileServiceUser> t, LoginPlatform platform = null)
        {
            IsLoading = false;

            if (t.Status == TaskStatus.RanToCompletion && t.Result != null && !string.IsNullOrEmpty(t.Result.UserId))
            {
                //Save our app settings for next launch
                var settings = this.GetService <ISettingsProvider>();

                settings.UserId = t.Result.UserId;

                if (platform != null)
                {
                    settings.AuthenticationProvider = (int)platform.Provider;
                }

                settings.Save();

                //Navigate to the Lists view
                RequestNavigate <WishListsViewModel>();
            }
            else
            {
                //Show Error
                ReportError("Login Failed!");
            }
        }
示例#2
0
        private void HandleLoginResult(Task <MobileServiceUser> t, LoginPlatform platform = null)
        {
            if (t.Status == TaskStatus.RanToCompletion && t.Result != null && !string.IsNullOrEmpty(t.Result.UserId))
            {
                //Save our app settings for next launch
                var settings = SettingsPresenter.Current;

                settings.UserId = t.Result.UserId;

                if (platform != null)
                {
                    settings.AuthenticationProvider = (int)platform.Provider;
                }

                settings.Save();
                RunOnUiThread(() =>
                {
                    Toast.MakeText(this, "Login Successful", ToastLength.Long).Show();
                    //Navigate to the Lists view
                    //RequestNavigate<WishListsViewModel>();
                    var i = new Intent(this, typeof(ItemListActivity));
                    i.AddFlags(ActivityFlags.ClearTop);
                    StartActivity(i);
                });
            }
            else
            {
                RunOnUiThread(() => { Toast.MakeText(this, "Login Failed", ToastLength.Long).Show(); });
                //Show Error
                //ReportError("Login Failed!");
            }
        }
示例#3
0
 /// <summary>
 /// 登陆
 /// </summary>
 public static void LoginByPlatform(LoginPlatform loginPlatform, string tag = "")
 {
     if (s_useNewSDKManager)
     {
         //SDKManagerNew.Login(SDKName, tag);
         Debug.LogError("SDKManager Login Exception: no implement in NewSDKManager");
     }
     else
     {
         try
         {
             bool isHvae = false;
             foreach (var item in s_loginServiceList)
             {
                 if (item.GetPlatform().Contains(Application.platform) && item.GetLoginPlatform() == loginPlatform)
                 {
                     item.Login(tag);
                     isHvae = true;
                 }
             }
             if (!isHvae)
             {
                 Debug.LogError("SDKManager Login dont find class by platform:" + Application.platform + " loginPlatform:" + loginPlatform);
             }
         }
         catch (Exception e)
         {
             Debug.LogError("SDKManager Login Exception: " + e.ToString());
         }
     }
 }
 /// <summary>
 /// 判断是否能使用商店(规则是当前是游客登录,并且未绑定其他登录方式)
 /// </summary>
 /// <param name="loginType">当前登录方式</param>
 /// <returns></returns>
 public static bool CheckCanUseStore(LoginPlatform loginType)
 {
     if (areadyBindPlatform.Contains(loginType) && areadyBindPlatform.Count == 1 && loginType == LoginPlatform.Tourist)
     {
         return(false);
     }
     return(true);
 }
 //Could be shared by
 public void Login(LoginPlatform platform)
 {
     RBAListPresenter.Current.Logout();
     RBAListPresenter.Current.MobileService.LoginAsync(this, platform.Provider).ContinueWith((t) =>
     {
         HandleLoginResult(t, platform);
     }, TaskScheduler.FromCurrentSynchronizationContext());
 }
示例#6
0
    public static AccountMergeInfo2Server GetMessage(LoginPlatform loginType, String typeKey, string pw)
    {
        AccountMergeInfo2Server msg = new AccountMergeInfo2Server();

        msg.loginType = loginType;
        msg.typeKey   = typeKey;
        msg.pw        = pw;

        msg.deviceUniqueIdentifier = SystemInfoManager.deviceUniqueIdentifier;
        msg.platform             = Application.platform;
        msg.deviceSystemLanguage = Application.systemLanguage;

        return(msg);
    }
    public static UserLogin2Server GetLoginMessage(LoginPlatform loginType, String typeKey, String pw)
    {
        UserLogin2Server msg = new UserLogin2Server();

        msg.loginType = loginType;
        msg.typeKey   = typeKey;
        msg.pw        = pw;

        msg.deviceUniqueIdentifier = SystemInfo.deviceUniqueIdentifier;
        msg.platform             = Application.platform;
        msg.deviceSystemLanguage = Application.systemLanguage;

        return(msg);
    }
    /// <summary>
    /// 请求绑定账户
    /// </summary>
    /// <param name="loginPlatform"></param>
    /// <param name="accountID"></param>
    /// <param name="pw"></param>
    public static void MergeLoginPlatform(LoginPlatform loginPlatform, string accountID = "", string pw = "")
    {
        SDKManager.LoginCallBack += SDKLoginCallBack;
        string tag = "";

        if (loginPlatform == LoginPlatform.AccountLogin)
        {
            accountID = accountID.Trim();
            pw        = pw.Trim();
            string pwMd5 = HDJ.Framework.Utils.MD5Utils.GetObjectMD5(pw);
            tag = accountID + "|" + pwMd5;
        }
        SDKManager.LoginByPlatform(loginPlatform, tag);
    }
    /// <summary>
    /// 登录
    /// </summary>
    /// <param name="loginPlatform"></param>
    /// <param name="accountID"></param>
    /// <param name="pw"></param>
    public static void Login(LoginPlatform loginPlatform, string accountID = "", string pw = "", string custom = "")
    {
        SDKManager.LoginCallBack += SDKLoginCallBack;

        string tag = "";

        accountID = accountID.Trim();
        pw        = pw.Trim();
        string pwMd5 = MD5Utils.GetObjectMD5(pw);

        tag = accountID + "|" + pwMd5 + "|" + custom;

        SDKManager.LoginByPlatform(loginPlatform, tag);
    }
示例#10
0
        public void Login(LoginPlatform platform)
        {
            IsLoading = true;

            App.Logout();

#if MONOANDROID
            var activity = this.GetService <Cirrious.MvvmCross.Droid.Interfaces.IMvxAndroidCurrentTopActivity>().Activity;

            App.Azure.LoginAsync(activity, platform.Provider).ContinueWith((t) => HandleLoginResult(t, platform));
#elif MONOTOUCH
            App.Azure.LoginAsync(ViewController, platform.Provider).ContinueWith((t) => HandleLoginResult(t, platform));
#else
            App.Azure.LoginAsync(platform.Provider).ContinueWith((t) => HandleLoginResult(t, platform));
#endif
        }
示例#11
0
    public static UserLogin2Server GetLoginMessage(LoginPlatform loginType, String typeKey, String pw, string activationCode)
    {
        UserLogin2Server msg = new UserLogin2Server();

        msg.loginType      = loginType;
        msg.typeKey        = typeKey;
        msg.pw             = pw;
        msg.activationCode = activationCode;

        msg.deviceUniqueIdentifier = SystemInfoManager.deviceUniqueIdentifier;
        msg.platform             = Application.platform;
        msg.deviceSystemLanguage = Application.systemLanguage;
        msg.clientVersion        = ApplicationManager.Version;
        msg.clientUseLanguage    = LanguageManager.CurrentLanguage;
        return(msg);
    }
示例#12
0
    public string m_CustomInfo;        //传入的自定义文本

    public override void LoadData(string key)
    {
        DataTable table = DataManager.GetData("LoginConfigData");

        if (!table.ContainsKey(key))
        {
            throw new Exception("LoginConfigDataGenerate LoadData Exception Not Fond key ->" + key + "<-");
        }

        SingleData data = table[key];

        m_key             = key;
        m_loginName       = data.GetEnum <LoginPlatform>("loginName");
        m_UIIcon          = data.GetString("UIIcon");
        m_UseItem         = data.GetBool("UseItem");
        m_Description     = data.GetString("Description");
        m_LoginClassName  = data.GetString("LoginClassName");
        m_SupportPlatform = data.GetStringArray("SupportPlatform");
        m_CustomInfo      = data.GetString("CustomInfo");
    }
示例#13
0
    /// <summary>
    /// 请求绑定账户
    /// </summary>
    /// <param name="loginPlatform"></param>
    /// <param name="accountID"></param>
    /// <param name="pw"></param>
    public static void MergeLoginPlatform(LoginPlatform loginPlatform, string accountID = "", string pw = "")
    {
        if (isWaiting)
        {
            Debug.LogError("AccountMergeController => 等待sdk返回登录信息");
            return;
        }
        isWaiting = true;

        SDKManager.LoginCallBack += SDKLoginCallBack;
        string tag = "";

        if (loginPlatform == LoginPlatform.AccountLogin)
        {
            accountID = accountID.Trim();
            pw        = pw.Trim();
            string pwMd5 = HDJ.Framework.Utils.MD5Utils.GetObjectMD5(pw);
            tag = accountID + "|" + pwMd5;
        }
        SDKManager.LoginByPlatform(loginPlatform, tag);
    }
        public LoginResultDto <UserDto> LoginCheck(string account, string passwd, LoginPlatform loginPlatform)
        {
            LoginResultDto <UserDto> result = new LoginResultDto <UserDto>();

            try
            {
                if (String.IsNullOrWhiteSpace(account) || String.IsNullOrWhiteSpace(passwd))
                {
                    result.Failed("用户名/密码不能为空!");
                    return(result);
                }


                //passwd = RSAHelper.Instance.Encrypt(account+passwd);
                var user = FindUserByLoginName(account);
                if (user == null || user.State == UserStatus.Deleted || user.LoginPasswd != passwd)
                {
                    result.Failed("用户名/密码错误!");
                    return(result);
                }
                if (user.State == UserStatus.Forbid)
                {
                    result.Failed("您的账号已被停用,请联系单位管理员!");
                    return(result);
                }

                result.Success("登录成功!");
                result.Data = user;
                //走到这里说明验证通过
            }
            catch (Exception ex)
            {
                result.Failed(ex);
            }


            return(result);
        }
示例#15
0
 /// <summary>
 /// 登陆
 /// </summary>
 public static void LoginByPlatform(LoginPlatform loginPlatform, string tag = "")
 {
     try
     {
         bool isHave = false;
         foreach (var item in s_loginServiceList)
         {
             if (item.GetPlatform().Contains(Application.platform) && item.GetLoginPlatform() == loginPlatform)
             {
                 item.Login(tag);
                 isHave = true;
             }
         }
         if (!isHave)
         {
             Debug.LogError("SDKManager Login dont find class by platform:" + Application.platform + " loginPlatform:" + loginPlatform);
         }
     }
     catch (Exception e)
     {
         Debug.LogError("SDKManager Login Exception: " + e.ToString());
     }
 }
示例#16
0
        public void Login(LoginPlatform platform)
        {
            this.IsLoading = true;

            App.Logout();

#if MONOANDROID
            var activity = this.GetService <Cirrious.MvvmCross.Droid.Interfaces.IMvxAndroidCurrentTopActivity>().Activity;

            App.Azure.LoginAsync(activity, platform.Provider).ContinueWith((t) =>
#elif MONOTOUCH
            App.Azure.LoginAsync(ViewController, platform.Provider).ContinueWith((t) =>
#else
            App.Azure.LoginAsync(platform.Provider).ContinueWith((t) =>
#endif
            {
                this.IsLoading = false;

                if (t.Status == System.Threading.Tasks.TaskStatus.RanToCompletion && t.Result != null && !string.IsNullOrEmpty(t.Result.UserId))
                {
                    //Save our app settings for next launch
                    var settings = this.GetService <Interfaces.ISettingsProvider>();

                    settings.UserId = t.Result.UserId;
                    settings.AuthenticationProvider = (int)platform.Provider;
                    settings.Save();

                    //Navigate to the Lists view
                    RequestNavigate <WishListsViewModel>();
                }
                else
                {
                    //Show Error
                    this.ReportError("Login Failed!");
                }
            });
        }
示例#17
0
 private void Login(LoginPlatform platform)
 {
     RBAListPresenter.Current.Logout();
     RBAListPresenter.Current.MobileService.LoginAsync(this, platform.Provider).ContinueWith((t) => HandleLoginResult(t, platform));
 }
示例#18
0
 public bool ValidateToken(string token, LoginPlatform loginPlatform)
 {
     return(Tools.ValidateToken(token, loginPlatform));
 }
示例#19
0
        public bool LoginOut(string token, LoginPlatform loginPlatform)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(token))
                {
                    return(false);
                }

                var webToken = Newtonsoft.Json.JsonConvert.DeserializeObject <TokenDto>(RSAHelper.Instance.Decrypt(token));
                if (webToken != null)
                {
                    string lastToken;
                    bool   result = false;
                    switch (loginPlatform)
                    {
                    case LoginPlatform.Web:
                        lastToken = RedisHelper.Instance.GetHash <String>(RedisCacheTables.WebTokenDto, webToken.UserId);
                        if (lastToken != null && lastToken.Equals(webToken))
                        {
                            result = RedisHelper.Instance.DeleteHash(RedisCacheTables.WebTokenDto, webToken.UserId);
                        }
                        else
                        {
                            result = true;
                        }
                        break;
                        //case LoginPlatform.DownloadClient:
                        //    lastToken = RedisHelper.Instance.GetHash<String>(RedisCacheTables.DownloadClientTokenDto, webToken.UserId);
                        //    if (lastToken != null && lastToken.Equals(webToken))
                        //        result = RedisHelper.Instance.DeleteHash(RedisCacheTables.DownloadClientTokenDto, webToken.UserId);
                        //    else
                        //        result = true;
                        //    break;
                        //case LoginPlatform.BusinessClient:
                        //    lastToken = RedisHelper.Instance.GetHash<String>(RedisCacheTables.BusinessClientTokenDto, webToken.UserId);
                        //    if (lastToken != null && lastToken.Equals(webToken))
                        //        result = RedisHelper.Instance.DeleteHash(RedisCacheTables.BusinessClientTokenDto, webToken.UserId);
                        //    else
                        //        result = true;
                        //    break;
                    }
                    return(result);
                }
                else
                {
                    return(false);
                }
                //var array = desToken.Split("&nbspqxsd;");
                //if (array.Length != 2)
                //{
                //    return false;
                //}
                //else
                //{


                //    var webotken = RedisHelper.Instance.DeleteKey(array[0]);
                //    if (webotken == null || webotken.Token != token)
                //        return false;
                //    else
                //    {
                //        return RedisHelper.Instance.DeleteHash<WebTokenDto>(webotken.Account);
                //    }
                //}
            }
            catch
            {
                return(false);
            }
        }
示例#20
0
        //Most of this could be shared
        public void HandleLoginResult(System.Threading.Tasks.Task <Microsoft.WindowsAzure.MobileServices.MobileServiceUser> t, LoginPlatform platform)
        {
            if (t.Status == TaskStatus.RanToCompletion && t.Result != null && !string.IsNullOrEmpty(t.Result.UserId))
            {
                //Save our app settings for next launch
                var settings = SettingsPresenter.Current;

                settings.UserId = t.Result.UserId;

                if (platform != null)
                {
                    settings.AuthenticationProvider = (int)platform.Provider;
                }

                settings.Save();

                //Navigate to the Lists view
                //RequestNavigate<WishListsViewModel>();
                var homecontroller = new HomeViewController();
                this.NavigationController.PushViewController(homecontroller, true);
            }
            else
            {
                //Show Error
                //ReportError("Login Failed!");
            }
        }