예제 #1
0
        private void HandleLoginSuccess()
        {
            LoginResponse = tessApiLogin.LoginResponse;
            if (String.IsNullOrEmpty(LoginResponse?.access_token))
            {
                throw new Exception("access_token LEER!");
            }
            TessTools.SaveResponse(LoginResponse, null, true);

            tessApiLogin = null; // brauchen wir jetzt nicht mehr!
            myCarId      = null; // Can change for other user! Need to reset after login.
        }
예제 #2
0
        public async Task <TessApiLoginResult> Login(string username, string pass)
        {
            try {
                tessApiLogin = new TessApiLogin();
                bool loginFinished = await tessApiLogin.DoLogin(username, pass);

                if (!loginFinished)
                {
                    return(new TessApiLoginResult(true));                  // MFA required!
                }
                HandleLoginSuccess();
                return(new TessApiLoginResult(false));
            }
            catch (Exception ex) {
                Log.Error("MyTess.Login", ex);
                return(new TessApiLoginResult(ex));
            }
        }