Exemplo n.º 1
0
        public int CheckLogin(BeLogin a) //Login Info Checker
        {
            if ((a.LoginPassword == obj2.GetPass()) && (a.LoginName == "admin"))
            {
                FormsAuthentication.SetAuthCookie(a.LoginPassword, true);
                return(1);
            }

            else if ((a.LoginPassword == obj2.GetPass()) && (a.LoginName != "admin"))
            {
                return(2);
            }

            else if ((a.LoginPassword != obj2.GetPass()) && (a.LoginName == "admin"))
            {
                return(3);
            }

            else if (a.LoginName == "" && a.LoginPassword == "")
            {
                return(0);
            }

            else
            {
                return(-1);
            }
        } /*CHECK COMPLETE*/
Exemplo n.º 2
0
        private async void beLoginoroutButton_Click(object sender, EventArgs e)
        {
            BeLogin bl = new BeLogin();

            if (!Boolean.Parse(this.isBeLoginLabel.Text))
            {
                if (String.IsNullOrWhiteSpace(this.user.Text) || String.IsNullOrWhiteSpace(this.password.Text))
                {
                    return;
                }
                bool b = await bl.Login(this.user.Text, this.password.Text);

                if (b)
                {
                    MessageBox.Show("ログインに成功しました");
                    this.isBeLoginLabel.Text     = "True";
                    this.SettingData.IsBeLogin   = true;
                    this.beLoginoroutButton.Text = "ログアウト";
                }
                else
                {
                    MessageBox.Show("ログインに失敗しました");
                    this.beLoginoroutButton.Text = "ログイン";
                    this.SettingData.IsBeLogin   = false;
                }
            }
            else
            {
                bl.Logout();
                this.isBeLoginLabel.Text = "False";
                MessageBox.Show("ログアウトに成功しました");
                this.SettingData.IsBeLogin   = false;
                this.beLoginoroutButton.Text = "ログイン";
            }
        }
Exemplo n.º 3
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            BeLogin a = new BeLogin();

            // Business Entity object to store login info

            a.LoginName     = TxtLoginName.Text;
            a.LoginPassword = TxtLoginPass.Text;

            BalClass b = new BalClass();
            // BAL object

            int error = b.CheckLogin(a);

            if (error == 1)
            {
                Response.Redirect("~/Pages/Home.aspx");
            }

            else if (error == 2)
            {
                string script = "alert('Invalid User !!');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", script, true);
            }

            else if (error == 3)
            {
                string script = "alert('Wrong Password !!');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", script, true);
            }

            else if (error == -1)
            {
                string script = "alert('Wrong Credentials !!');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", script, true);
            }

            else
            {
                string script = "alert('Fields Cannot be Empty !!');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", script, true);
            }
        }