diff options
| author | william341 <[email protected]> | 2017-06-19 12:16:31 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-06-19 12:16:31 -0700 |
| commit | 09e2268bc220b299ef2c1b8779c4df0b5ef4df3c (patch) | |
| tree | 4ebdeea150ea168678d6b08c8d1d20d246ee6ac2 /ShiftOS.WinForms/UniteLoginDialog.cs | |
| parent | c22370d643008e55121c0ddeaca0b81d755573ff (diff) | |
| parent | df37f3c366fe5884b17fa0b66d154536f8df93d2 (diff) | |
| download | shiftos_thereturn-09e2268bc220b299ef2c1b8779c4df0b5ef4df3c.tar.gz shiftos_thereturn-09e2268bc220b299ef2c1b8779c4df0b5ef4df3c.tar.bz2 shiftos_thereturn-09e2268bc220b299ef2c1b8779c4df0b5ef4df3c.zip | |
Merge pull request #4 from shiftos-game/master
pulling
Diffstat (limited to 'ShiftOS.WinForms/UniteLoginDialog.cs')
| -rw-r--r-- | ShiftOS.WinForms/UniteLoginDialog.cs | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/ShiftOS.WinForms/UniteLoginDialog.cs b/ShiftOS.WinForms/UniteLoginDialog.cs deleted file mode 100644 index c78e987..0000000 --- a/ShiftOS.WinForms/UniteLoginDialog.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using ShiftOS.Engine; -using System.Net; -using ShiftOS.Objects; - -namespace ShiftOS.WinForms -{ - public partial class UniteLoginDialog : UserControl, IShiftOSWindow - { - public UniteLoginDialog(Action<string> callback) - { - InitializeComponent(); - Callback = callback; - } - - private Action<string> Callback { get; set; } - - public void OnLoad() - { - this.ParentForm.AcceptButton = btnlogin; - } - - public void OnSkinLoad() - { - } - - public bool OnUnload() - { - return true; - } - - public void OnUpgrade() - { - } - - private void btnlogin_Click(object sender, EventArgs e) - { - string u = txtusername.Text; - string p = txtpassword.Text; - - if (string.IsNullOrWhiteSpace(u)) - { - Infobox.Show("Please enter a username.", "You must enter a proper email address."); - return; - } - - if (string.IsNullOrWhiteSpace(p)) - { - Infobox.Show("Please enter a password.", "You must enter a valid password."); - return; - } - - try - { - var webrequest = HttpWebRequest.Create(UserConfig.Get().UniteUrl + "/Auth/Login?appname=ShiftOS&appdesc=ShiftOS+client&version=1_0_beta_2_4"); - string base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{u}:{p}")); - webrequest.Headers.Add("Authentication: Basic " + base64); - var response = webrequest.GetResponse(); - var str = response.GetResponseStream(); - var reader = new System.IO.StreamReader(str); - string result = reader.ReadToEnd(); - reader.Close(); - str.Close(); - str.Dispose(); - response.Dispose(); - Callback?.Invoke(result); - AppearanceManager.Close(this); - } -#if DEBUG - catch(Exception ex) - { - Infobox.Show("Error", ex.ToString()); - } -#else - catch - { - Infobox.Show("Login failed.", "The login attempt failed due to an incorrect username and password pair."); - } -#endif - - } - } -} |
