Esempio n. 1
0
        internal IPersistence AuthenticateByMasterPassword(IPersistence persistence, IStartupUi startupUi, string masterPasswordArg = null)
        {
            bool authenticated = persistence.Security.Authenticate(startupUi.KnowsUserPassword, masterPasswordArg);

            if (!authenticated)
            {
                startupUi.Exit();
            }

            bool initialized = persistence.Initialize();

            if (!initialized)
            {
                return(this.TryFallbackToPrimaryPersistence(persistence, startupUi));
            }

            return(persistence);
        }
Esempio n. 2
0
        private IPersistence TryFallbackToPrimaryPersistence(IPersistence persistence, IStartupUi startupUi)
        {
            bool         fallbackInitialized = false;
            IPersistence newPersistence      = null;

            if (persistence.TypeId != FilePersistence.TYPE_ID && startupUi.UserWantsFallback())
            {
                newPersistence      = this.FallBackToPrimaryPersistence(persistence.Security);
                fallbackInitialized = newPersistence.Initialize();
            }

            if (!fallbackInitialized)
            {
                startupUi.Exit();
            }

            return(newPersistence);
        }
Esempio n. 3
0
        internal IPersistence AuthenticateByMasterPassword(IPersistence persistence, IStartupUi startupUi)
        {
            var authenticated = persistence.Security.Authenticate(startupUi.KnowsUserPassword);

            if (!authenticated)
            {
                startupUi.Exit();
            }

            var initialized = persistence.Initialize();

            if (!initialized)
            {
                return(this.TryFallbackToPrimaryPersistence(persistence, startupUi));
            }

            return(persistence);
        }