string ReadSettings(IntPtr hParentWnd, string serviceUri, ref string userId) { INameValueStore storage = new CSharpTest.Net.Serialization.StorageClasses.RegistryStorage(); try { string password; storage.Read(serviceUri, "UserName", out userId); if (storage.Read(serviceUri, "Password", out password)) { return(Encryption.CurrentUser.Decrypt(password)); } } catch { } PasswordEntry pwdDlg = new PasswordEntry(userId, serviceUri); if (pwdDlg.ShowDialog(Win32Window.FromHandle(hParentWnd)) == DialogResult.OK) { userId = pwdDlg.UserName.Text; SaveSettings(userId, serviceUri, pwdDlg.Password.Text); return(pwdDlg.Password.Text); } return(null); }
string ReadSettings(IntPtr hParentWnd, string serviceUri, ref string userId) { Log.Verbose("Acquiring username and password"); INameValueStore storage = new CSharpTest.Net.Serialization.StorageClasses.RegistryStorage(); try { Log.Verbose("Trying to read username and password from the cache"); string password; storage.Read(serviceUri, "UserName", out userId); if (storage.Read(serviceUri, "Password", out password)) { string pass = Encryption.CurrentUser.Decrypt(password); Log.Verbose("Successfully read Username and password from the cache"); return(pass); } } catch { } Log.Verbose("Failed reading username and password from the cache. Prompting user"); PasswordEntry pwdDlg = new PasswordEntry(userId, serviceUri); if (pwdDlg.ShowDialog(Win32Window.FromHandle(hParentWnd)) == DialogResult.OK) { userId = pwdDlg.UserName.Text; SaveSettings(userId, serviceUri, pwdDlg.Password.Text); return(pwdDlg.Password.Text); } return(null); }
string ReadSettings(IntPtr hParentWnd, string serviceUri, ref string userId) { INameValueStore storage = new CSharpTest.Net.Serialization.StorageClasses.RegistryStorage(); try { string password; storage.Read(serviceUri, "UserName", out userId); if (storage.Read(serviceUri, "Password", out password)) return Encryption.CurrentUser.Decrypt(password); } catch { } PasswordEntry pwdDlg = new PasswordEntry(userId, serviceUri); if (pwdDlg.ShowDialog(Win32Window.FromHandle(hParentWnd)) == DialogResult.OK) { userId = pwdDlg.UserName.Text; SaveSettings(userId, serviceUri, pwdDlg.Password.Text); return pwdDlg.Password.Text; } return null; }
string ReadSettings(IntPtr hParentWnd, string serviceUri, ref string userId) { Log.Verbose("Acquiring username and password"); INameValueStore storage = new CSharpTest.Net.Serialization.StorageClasses.RegistryStorage(); try { Log.Verbose("Trying to read username and password from the cache"); string password; storage.Read(serviceUri, "UserName", out userId); if (storage.Read(serviceUri, "Password", out password)) { string pass = Encryption.CurrentUser.Decrypt(password); Log.Verbose("Successfully read Username and password from the cache"); return pass; } } catch { } Log.Verbose("Failed reading username and password from the cache. Prompting user"); PasswordEntry pwdDlg = new PasswordEntry(userId, serviceUri); if (pwdDlg.ShowDialog(Win32Window.FromHandle(hParentWnd)) == DialogResult.OK) { userId = pwdDlg.UserName.Text; SaveSettings(userId, serviceUri, pwdDlg.Password.Text); return pwdDlg.Password.Text; } return null; }