Пример #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            LoginP lp = new LoginP(txtUsername.Text, txtPassword.Text);

            if (lp.checkIfHasErrors() == true)
            {
                if (lp.getErrors()[0] == "500")
                {
                    Response.Redirect("~/error");
                }
                else
                {
                    err.Text = lp.getErrors()[0];
                }
            }
            else
            {
                Session["user"] = lp.getUserId();
                Dt     dt    = new Dt();
                string year  = dt.getYearVal().ToString();
                string month = dt.getMonthVal().ToString();
                string date  = dt.getDayVal().ToString();
                Response.Redirect("~/calender?y=" + year + "&m=" + month + "&d=" + date + "");
            }
        }
Пример #2
0
        public async Task <IActionResult> Login(LoginP user)
        {
            //Checking if user exist and credentials are ok
            var userDB = await _Auth.GetAndVerifyUser(user.Mail.ToLower(), user.Password);

            if (userDB == null)
            {
                return(Unauthorized("Invalid User or password"));
            }

            var tok = _Auth.Login(userDB);

            return(Ok(new{
                token = tok,
                email = user.Mail,
                expiresIn = 60
            }));
        }
 // Login button
 private void Login_Click(object sender, EventArgs e)
 {
     try
     {
         int ID = LoginP.GetLogin().ID;
         if (ID == 0)
         {
             Console.WriteLine("Login Failed");
             labelUserWrong.Visible = true;
             labelPassWrong.Visible = true;
             //MessageBox.Show(LoginErrorMessage, LoginErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             labelUserWrong.Visible = false;
             labelPassWrong.Visible = false;
             if (checkRemember.Checked)
             {
                 Properties.Settings.Default.userName = flatTxtUser.Text;
                 Properties.Settings.Default.passUser = flatTxtPass.Text;
                 Properties.Settings.Default.Save();
             }
             else
             {
                 Properties.Settings.Default.userName = string.Empty;
                 Properties.Settings.Default.passUser = string.Empty;
                 Properties.Settings.Default.Save();
             }
             F001_Main main = new F001_Main(ID);
             main.Show();
             this.Close();
         }
     }
     catch (Exception)
     {
         MessageBox.Show(ExceptionErrorMeessage, ExceptionErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #4
0
 private void SignUp_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     LoginP.SendToBack();
 }
Пример #5
0
 public Login()
 {
     InitializeComponent();
     LoginP.BringToFront();
     UserID.Focus();
 }