public void prompt(Host bookmark, Credentials credentials, String title, String reason, LoginOptions options) { View = ObjectFactory.GetInstance <ILoginView>(); InitEventHandlers(); _bookmark = bookmark; _credentials = credentials; _options = options; View.Title = LocaleFactory.localizedString(title, "Credentials"); View.Message = LocaleFactory.localizedString(reason, "Credentials"); View.Username = credentials.getUsername(); View.SavePasswordState = credentials.isSaved(); if (_options.icon() != null) { View.DiskIcon = IconCache.Instance.IconForName(_options.icon(), 64); } else { View.DiskIcon = IconCache.Instance.IconForName(_bookmark.getProtocol().disk(), 64); } InitPrivateKeys(); Update(); AsyncController.AsyncDelegate d = delegate { if (DialogResult.Cancel == View.ShowDialog(_browser.View)) { throw new LoginCanceledException(); } }; _browser.Invoke(d); }
public Credentials prompt(Host bookmark, String username, String title, String reason, LoginOptions options) { View = ObjectFactory.GetInstance <ILoginView>(); var credentials = new Credentials().withSaved(options.keychain()).withUsername(username); InitEventHandlers(bookmark, credentials, options); View.Title = LocaleFactory.localizedString(title, "Credentials"); View.Message = LocaleFactory.localizedString(reason, "Credentials"); View.Username = username; View.SavePasswordState = options.keychain(); View.DiskIcon = Images.Get(options.icon()).Size(64); InitPrivateKeys(); Update(credentials, options); AsyncDelegate d = delegate { if (DialogResult.Cancel == View.ShowDialog(_browser.View)) { throw new LoginCanceledException(); } }; _browser.Invoke(d); return(credentials); }
public Credentials prompt(Host bookmark, string title, string reason, LoginOptions options) { Credentials credentials = new Credentials().withSaved(options.keychain()); AsyncDelegate d = delegate { View = ObjectFactory.GetInstance <IPasswordPromptView>(); View.Title = title; View.Reason = new StringAppender().append(reason).toString(); View.OkButtonText = LocaleFactory.localizedString("Continue", "Credentials"); View.IconView = Images.Get(options.icon()).Size(64); View.SavePasswordEnabled = options.keychain(); View.SavePasswordState = credentials.isSaved(); View.ValidateInput += ValidateInputEventHandler; if (DialogResult.Cancel == View.ShowDialog(_browser.View)) { throw new LoginCanceledException(); } credentials.setPassword(View.InputText); credentials.setSaved(View.SavePasswordState); }; _browser.Invoke(d); return(credentials); }
public Credentials prompt(Host bookmark, string title, string reason, LoginOptions options) { Credentials credentials = new VaultCredentials(); credentials.setSaved(options.save()); AsyncDelegate d = delegate { View = ObjectFactory.GetInstance <IPasswordPromptView>(); View.Title = title; View.Reason = reason; View.OkButtonText = LocaleFactory.localizedString("Continue", "Credentials"); View.IconView = IconCache.Instance.IconForName(options.icon(), 64); View.SavePassword = options.save(); View.ValidateInput += ValidateInputEventHandler; if (DialogResult.Cancel == View.ShowDialog(_browser.View)) { throw new LoginCanceledException(); } credentials.setPassword(View.InputText); credentials.setSaved(View.SavePassword); }; _browser.Invoke(d); return(credentials); }
public Credentials prompt(Host bookmark, String username, String title, String reason, LoginOptions options) { View = ObjectFactory.GetInstance <ILoginView>(); InitEventHandlers(); _bookmark = bookmark; _options = options; _credentials.setSaved(_options.save()); _credentials.setUsername(username); View.Title = LocaleFactory.localizedString(title, "Credentials"); View.Message = LocaleFactory.localizedString(reason, "Credentials"); View.Username = username; View.SavePasswordState = _options.save(); View.DiskIcon = IconCache.Instance.IconForName(_options.icon(), 64); InitPrivateKeys(); Update(); AsyncController.AsyncDelegate d = delegate { if (DialogResult.Cancel == View.ShowDialog(_browser.View)) { throw new LoginCanceledException(); } }; _browser.Invoke(d); return(_credentials); }
public void prompt(Credentials credentials, string title, string reason, LoginOptions options) { AsyncDelegate d = delegate { View = ObjectFactory.GetInstance <IPasswordPromptView>(); View.Title = title; View.Reason = reason; View.OkButtonText = LocaleFactory.localizedString("Unlock Vault", "Cryptomator"); View.IconView = IconCache.Instance.IconForName(options.icon(), 64); View.SavePassword = false; View.ValidateInput += ValidateInputEventHandler; if (DialogResult.Cancel == View.ShowDialog(_browser.View)) { throw new LoginCanceledException(); } credentials.setPassword(View.InputText); credentials.setSaved(View.SavePassword); }; _browser.Invoke(d); }