/// <summary> /// Executes the fastLogin /// If the fastLogin fails, a normal login is beeing executed /// </summary> /// <returns>The loginResult of the fastLogin</returns> private static async Task <LoginResult> FastLogin() { Console.WriteLine("...FastLogin..."); LoginResult loginResult; try { string exeFolder = PathHandler.ExeFolder; string fastLoginFile = $@"{exeFolder}\fastLogin.txt"; if (!File.Exists(fastLoginFile)) { throw new FileNotFoundException($"No fastLogin file found in {exeFolder}"); } string password = File.ReadAllText(fastLoginFile); loginResult = await BitwardenAuthManager.Unlock(password); if (!loginResult.IsLoggedIn) { throw new ArgumentException(loginResult.ErrorMessage); } return(loginResult); } catch { loginResult = await BitwardenUIAuthManager.Login(); return(loginResult); } }
public static async Task <LoginResult> Login() { var authStatus = await BitwardenAuthManager.GetAuthStatus(); if (authStatus.Status == BitwardenStatus.Unlocked) { //Login finished return(LoginResult.CreateSucess(authStatus.UserEmail)); } var loginResult = new LoginWindow().ShowLogin(authStatus); return(loginResult); }