Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var username = (string.IsNullOrEmpty(Request["user"]?.ToString())) ? string.Empty : Request["user"].ToString();
            var password = (string.IsNullOrEmpty(Request["pass"]?.ToString())) ? string.Empty : Request["pass"].ToString();

            contLogin     = new LoginController();
            mobileSession = contLogin.Login(username, password);
            var json = new StringBuilder();

            json.Append("[");
            json.Append("{");
            json.Append("'authenticated':'" + mobileSession.authenticated + "',");
            json.Append("'anti':'" + mobileSession.anti + "',");
            json.Append("'scram':'" + mobileSession.scram + "',");
            json.Append("'activity':'" + mobileSession.activity + "',");
            json.Append("'pass':'******',");
            json.Append("'mas':'" + mobileSession.mas + "',");
            json.Append("'faults':'" + mobileSession.faults + "',");
            json.Append("'role':'" + mobileSession.role + "',");
            json.Append("'group':'" + mobileSession.group + "',");
            json.Append("'comp':'" + mobileSession.comp + "',");
            json.Append("'campus':'" + mobileSession.campus + "',");
            json.Append("'code':'" + mobileSession.code + "'");
            json.Append("}");
            json.Append("]");
            var resp = json.Replace("'", "\"").ToString();

            Response.Clear();
            Response.AddHeader("Content-type", "text/json");
            Response.Write(resp);
            Response.End();
        }
Пример #2
0
 public LoginController()
 {
     _session = new MobileSessionModel();
     _session.authenticated = "false";
     _session.anti          = "authenticate";
     _session.scram         = "saltnvinegar";
     _session.activity      = "authorize";
     _session.pass          = "******";
     _session.mas           = "system";
     _session.faults        = "false";
 }
Пример #3
0
        protected void ButtonLogin_Click(object sender, EventArgs e)
        {
            var username = TextUsername.Text;
            var password = TextPassword.Text;

            contLogin     = new LoginController();
            mobileSession = contLogin.Login(username, password);

            if (mobileSession.authenticated == "true")
            {
                Session["mas"]   = mobileSession.mas;
                Session["comp"]  = mobileSession.comp;
                Session["role"]  = mobileSession.role;
                Session["group"] = mobileSession.group;
                Response.Redirect("dailytasks.aspx");
            }
        }