Beispiel #1
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                string username = txtUserName.Text.Trim().ToLower();
                string password = txtPassword.Text.Trim();

                //int loginstatus = oSecurityClient.ValidateUser(username, password);

                string EncryptedPwd = Cryptography.Encryption.Encrypt(txtPassword.Text, txtUserName.Text);

                LoginDTO oLoginDTO = new LoginDTO();

                oLoginDTO = oWebApiCalls.GetLoginData(username);


                lblMessage.Visible = false;
                lblMessage.Text    = string.Empty;

                if (oLoginDTO.Password != null)
                {
                    if (EncryptedPwd == oLoginDTO.Password)
                    {
                        UpdateSessions();
                        Session["UserType"] = oLoginDTO.UserType;
                        Response.Redirect("~/Pages/Dashboard.aspx");
                    }
                    else
                    {
                        lblMessage.Text = "User Name Or Password Incorrect";
                    }
                }
                else
                {
                    lblMessage.Text = "Please Create Account First!";
                    btnCreateAccount.Focus();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }