2016-06-12 06:54:14 +12:00
|
|
|
|
#region License Information (GPL v3)
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
ShareX - A program that allows you to take screenshots and share any file type
|
2017-01-11 21:39:40 +13:00
|
|
|
|
Copyright (c) 2007-2017 ShareX Team
|
2016-06-12 06:54:14 +12:00
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
|
|
Optionally you can also view the license at <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#endregion License Information (GPL v3)
|
|
|
|
|
|
|
|
|
|
using ShareX.HelpersLib;
|
|
|
|
|
using ShareX.UploadersLib.FileUploaders;
|
|
|
|
|
using ShareX.UploadersLib.Properties;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
2016-06-20 18:44:21 +12:00
|
|
|
|
namespace ShareX.UploadersLib
|
2016-06-12 06:54:14 +12:00
|
|
|
|
{
|
|
|
|
|
public partial class PuushLoginForm : Form
|
|
|
|
|
{
|
|
|
|
|
public string APIKey { get; set; }
|
|
|
|
|
|
|
|
|
|
public PuushLoginForm()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
Icon = Resources.puush;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-20 18:44:21 +12:00
|
|
|
|
private bool ValidationCheck()
|
2016-06-12 06:54:14 +12:00
|
|
|
|
{
|
|
|
|
|
bool result = true;
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(txtEmail.Text))
|
|
|
|
|
{
|
|
|
|
|
txtEmail.BackColor = Color.FromArgb(255, 200, 200);
|
|
|
|
|
result = false;
|
|
|
|
|
}
|
2016-06-20 18:44:21 +12:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
txtEmail.BackColor = SystemColors.Window;
|
|
|
|
|
}
|
2016-06-12 06:54:14 +12:00
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(txtPassword.Text))
|
|
|
|
|
{
|
|
|
|
|
txtPassword.BackColor = Color.FromArgb(255, 200, 200);
|
|
|
|
|
result = false;
|
|
|
|
|
}
|
2016-06-20 18:44:21 +12:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
txtPassword.BackColor = SystemColors.Window;
|
|
|
|
|
}
|
2016-06-12 06:54:14 +12:00
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void llForgottenPassword_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
URLHelpers.OpenURL(Puush.PuushResetPasswordURL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnLogin_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2016-06-20 18:44:21 +12:00
|
|
|
|
if (ValidationCheck())
|
2016-06-12 06:54:14 +12:00
|
|
|
|
{
|
|
|
|
|
APIKey = new Puush().Login(txtEmail.Text, txtPassword.Text);
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(APIKey))
|
|
|
|
|
{
|
|
|
|
|
DialogResult = DialogResult.OK;
|
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Login failed.", "Authentication failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|