Esempio n. 1
0
        public ComRet Login(string account, string password, ClientType client, string client_sn)
        {
            var passport = MongoEntity.Get <Passport>(p => p.Account == account && p.Password == password);

            if (passport == null)
            {
                return(Result(false, "账户名不正确"));
            }

            Profile profile = MongoEntity.Get <Profile>(p => p.Account == account);

            if (profile == null)
            {
                return(Result(false, "账户不合法"));
            }

            profile.Client   = client;
            profile.ClientSN = client_sn;
            profile.Save();

            passport.Ticket = BusinessAuthentication.GenTicket(profile);
            passport.Save();

            return(Result(true, passport.Ticket));
        }
Esempio n. 2
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        IBusinessAuthentication iba = new BusinessAuthentication();

        if (iba.VerifyLogin(txtUsername.Text, txtPassword.Text) == true)
        {
            lblStatus.Text      = "Welcome " + txtUsername.Text;
            Session["LOGGEDIN"] = txtUsername.Text;
            Session.Timeout     = 1; // 1 minute expiration
        }
        else
        {
            lblStatus.Text = "invalid Login..";
        }
    }