private bool PromptUserToAuthenticate(string masterPasswordArg = null) { AuthenticationPrompt promptResults; if (string.IsNullOrEmpty(masterPasswordArg)) { promptResults = this.knowsUserPassword(false); } else { promptResults = new AuthenticationPrompt() { Canceled = false, Password = masterPasswordArg }; } bool authenticated = this.IsUserPaswordValid(promptResults); while (!(promptResults.Canceled || authenticated)) { promptResults = this.knowsUserPassword(true); authenticated = this.IsUserPaswordValid(promptResults); } return(authenticated); }
private bool IsUserPaswordValid(AuthenticationPrompt promptResults) { if (!promptResults.Canceled) return this.isMasterPasswordValid(promptResults.Password); return false; }
private bool IsUserPaswordValid(AuthenticationPrompt promptResults) { if (!promptResults.Canceled) { return(this.isMasterPasswordValid(promptResults.Password)); } return(false); }
/// <summary> /// Initialize new instance of the upgrade providing fresh not initialized persistence and password prompt. /// </summary> /// <param name="persistence">Not null,not authenticated, not initialized persistence</param> /// <param name="knowsUserPassword">Not null password prompt to obtain current master password from user</param> internal FilesV2ContentUpgrade(IPersistence persistence, Func<bool, AuthenticationPrompt> knowsUserPassword) { this.persistence = persistence; // prevents ask for password two times this.passwordsUpdate = new PasswordsV2Update(retry => { this.prompt = knowsUserPassword(retry); return this.prompt; }); }
private bool PromptUserToAuthenticate() { AuthenticationPrompt promptResults = this.knowsUserPassword(false); bool authenticated = this.IsUserPaswordValid(promptResults); while (!(promptResults.Canceled || authenticated)) { promptResults = this.knowsUserPassword(true); authenticated = this.IsUserPaswordValid(promptResults); } return(authenticated); }