protected bool doLogin(String username, String password)
        {
            bool result = false;

            UserPool userPool = (UserPool)Application["UserPool"];

            if (userPool.RegisterUser(username, password))
            {
                ltMessage.Text = "";

                FormsAuthentication.SignOut();
                FormsAuthentication.SetAuthCookie(username, false);


                Int32 userId     = userPool.GetUserId(username);
                Int32 userRoleId = userPool.GetUserRoleId(username);


                //----------------------------------------
                UcUserArgs args = new UcUserArgs();
                args.UserName   = username;
                args.Password   = password;
                args.UserId     = userId;
                args.UserRoleId = userRoleId;
                login(args);
                //----------------------------------------

                if (!args.Cancel)
                {
                    result = true;
                }
                else
                {
                    result = false;
                    doLogout(args.Message);
                }
            }
            else
            {
            }

            return(result);
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                NameValueCollection parameters = Request.QueryString;
                foreach (String key in parameters.AllKeys)
                {
                    Session.Add(key, parameters[key]);
                }
            }

            //Read
            String userName = (string)Session["userName"];
            String password = (string)Session["password"];

            if (Request.Cookies["UserName"] != null)
            {
                HttpCookie cookieUsername = Request.Cookies["UserName"];
                userName = Server.HtmlEncode(cookieUsername.Value);
            }
            if (Request.Cookies["Password"] != null)
            {
                HttpCookie cookiePassword = Request.Cookies["Password"];
                password = Server.HtmlEncode(cookiePassword.Value);
            }

            UserPool userPool = (UserPool)Application["UserPool"];

            if (userPool.RegisterUser(userName, password))
            {
                FormsAuthentication.SignOut();
                FormsAuthentication.SetAuthCookie(userName, false);

                Response.Redirect("UcKioskConnect.aspx");
            }
            else
            {
                Response.Redirect("UcKioskLogin.aspx");
            }
        }
Ejemplo n.º 3
0
        private bool DoLogin(String username, String password)
        {
            UserPool userPool = (UserPool)Application["UserPool"];

            if (userPool.RegisterUser(username, password))
            {
                FormsAuthentication.SignOut();
                FormsAuthentication.SetAuthCookie(username, false);

                Int32 userId     = userPool.GetUserId(username);
                Int32 userRoleId = userPool.GetUserRoleId(username);

                UcUserArgs args = new UcUserArgs();
                args.UserName   = username;
                args.Password   = password;
                args.UserId     = userId;
                args.UserRoleId = userRoleId;
                login(args);

                return(true);
            }

            return(false);
        }