Exemple #1
0
            private void OnOk_Click(object sender, EventArgs e)
            {
                string email    = this.emailTextBox.Text;
                string kiteName = this.kiteTextBox.Text;
                string password = this.passwordTextBox.Text;

                if (!this.ValidateEmail(email))
                {
                    PkLogging.Logger(PkLogging.Level.Warning, "Invalid email address", true);
                    return;
                }
                if (string.IsNullOrEmpty(kiteName))
                {
                    PkLogging.Logger(PkLogging.Level.Warning, "Invalid kite name", true);
                    return;
                }

                if (string.IsNullOrEmpty(password))
                {
                    if (this.agreeCheckBox.Checked)
                    {
                        if (PkService.CreateAccount(email, kiteName))
                        {
                            PkLogging.Logger(PkLogging.Level.Info, "An email containing your password and details has been sent to " + email, true);
                            return;
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        PkLogging.Logger(PkLogging.Level.Warning, "You must agree to the terms of service to continue.", true);
                    }
                }
                else
                {
                    PkServiceInfo info = PkService.Login(email, password, false);

                    if (info != null)
                    {
                        PkLogging.Logger(PkLogging.Level.Info, "Successfully signed in.");

                        password = "";
                        this.passwordTextBox.Text = "";

                        this.RememberMe  = this.rememberCheckBox.Checked;
                        this.ServiceInfo = info;

                        PkLoginForm parent = (this.Parent as PkLoginForm);
                        parent.Close_Login();
                    }
                    else
                    {
                        return;
                    }
                }
            }
Exemple #2
0
 public void Close_Login()
 {
     this.UsePagekiteNet = welcomePanel.UsePagekiteNet;
     this.RememberMe     = loginPanel.RememberMe;
     this.ServiceInfo    = loginPanel.ServiceInfo;
     this.DialogResult   = DialogResult.OK;
     this.Close();
 }
        public static PkServiceInfo Login(string a, string c, bool auto)
        {
            object[]   val;
            IPkService proxy = XmlRpcProxyGen.Create <IPkService>();

            try
            {
                if (auto)
                {
                    val = proxy.login(a, c, c);
                }
                else
                {
                    val = proxy.login(a, c, "");
                }
            }
            catch (Exception e)
            {
                PkLogging.Logger(PkLogging.Level.Error, "Unable to connect to the Pagekite Service"
                                 + Environment.NewLine + "Exception: " + e.Message, true);
                val = null;
            }

            if (val == null)
            {
                return(null);
            }

            string ok = val[0].ToString();

            if (!ok.Equals("ok"))
            {
                if (auto)
                {
                    return(null);
                }
                else
                {
                    PkLogging.Logger(PkLogging.Level.Warning, "Incorrect information", true);
                    return(null);
                }
            }

            string[] data = (string[])val[1];

            PkServiceInfo info = new PkServiceInfo();

            info.AccountId   = data[0];
            info.Credentials = data[1];

            return(info);
        }
Exemple #4
0
        private void LogIn()
        {
            if (this.data.Options.RememberMe)
            {
                PkServiceInfo info = PkService.Login(this.data.ServiceInfo.AccountId, this.data.ServiceInfo.Credentials, true);

                if (info != null)
                {
                    PkLogging.Logger(PkLogging.Level.Info, "Successfully logged in.");
                }
                else
                {
                    PkSplashForm.CloseSplashScreen();
                    this.ShowLoginForm();
                }
            }
            else
            {
                PkSplashForm.CloseSplashScreen();
                this.ShowLoginForm();
            }
        }
Exemple #5
0
            private void OnOk_Click(object sender, EventArgs e)
            {
                string email = this.emailTextBox.Text;
                string kiteName = this.kiteTextBox.Text;
                string password = this.passwordTextBox.Text;

                if (!this.ValidateEmail(email))
                {
                    PkLogging.Logger(PkLogging.Level.Warning, "Invalid email address", true);
                    return;
                }
                if (string.IsNullOrEmpty(kiteName))
                {
                    PkLogging.Logger(PkLogging.Level.Warning, "Invalid kite name", true);
                    return;
                }

                if (string.IsNullOrEmpty(password))
                {
                    if (this.agreeCheckBox.Checked)
                    {
                        if (PkService.CreateAccount(email, kiteName))
                        {
                            PkLogging.Logger(PkLogging.Level.Info, "An email containing your password and details has been sent to " + email, true);
                            return;
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        PkLogging.Logger(PkLogging.Level.Warning, "You must agree to the terms of service to continue.", true);
                    }
                }
                else
                {
                    PkServiceInfo info = PkService.Login(email, password, false);

                    if (info != null)
                    {
                        PkLogging.Logger(PkLogging.Level.Info, "Successfully signed in.");

                        password = "";
                        this.passwordTextBox.Text = "";

                        this.RememberMe = this.rememberCheckBox.Checked;
                        this.ServiceInfo = info;

                        PkLoginForm parent = (this.Parent as PkLoginForm);
                        parent.Close_Login();
                    }
                    else
                    {
                        return;
                    }
                }
            }
Exemple #6
0
        public static PkServiceInfo Login(string a, string c, bool auto)
        {
            object[] val;
            IPkService proxy = XmlRpcProxyGen.Create<IPkService>();

            try
            {
                if (auto)
                {
                    val = proxy.login(a, c, c);
                }
                else
                {
                    val = proxy.login(a, c, "");
                }
            }
            catch(Exception e)
            {
                PkLogging.Logger(PkLogging.Level.Error, "Unable to connect to the Pagekite Service"
                                 + Environment.NewLine + "Exception: " + e.Message, true);
                val = null;
            }

            if (val == null)
            {
                return null;
            }

            string ok = val[0].ToString();

            if (!ok.Equals("ok"))
            {
                if (auto)
                {
                    return null;
                }
                else
                {
                    PkLogging.Logger(PkLogging.Level.Warning, "Incorrect information", true);
                    return null;
                }
            }

            string[] data = (string[])val[1];

            PkServiceInfo info = new PkServiceInfo();

            info.AccountId = data[0];
            info.Credentials = data[1];

            return info;
        }