Ejemplo n.º 1
0
 public static UserModel Current(HttpSessionState Session)
 {
     var um = (UserModel)Session[IEnv.SESSION_USER];
     if (um == null)
     {
         um = new UserModel();
         Session[IEnv.SESSION_USER] = um;
     }
     return um;
 }
Ejemplo n.º 2
0
        public Akey(UserModel userModel)
        {
            _UserModel = userModel;

            InitializeComponent();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SignInDownloadStringCompleted(object sender, System.Net.UploadStringCompletedEventArgs e)
        {
            string xml = e.Result;
            string code = null;
            string pass = null;
            int view = 0;
            List<LibHeader> libKey = new List<LibHeader>();
            using (XmlReader reader = XmlReader.Create(new StringReader(xml)))
            {
                if (xml.IndexOf("<error>") > 0)
                {
                    BeanUtil.HideLoading();
                    reader.ReadToFollowing("error");
                    BeanUtil.ShowAlert(reader.ReadElementContentAsString());
                    return;
                }

                if (!reader.ReadToFollowing("code"))
                {
                    return;
                }
                code = reader.ReadElementContentAsString();

                pass = reader.ReadElementContentAsString();

                view = reader.ReadElementContentAsInt();

                if (reader.Name == "libs" || reader.ReadToNextSibling("libs"))
                {
                    while (reader.ReadToFollowing("lib"))
                    {
                        LibHeader header = new LibHeader();
                        header.FromXml(reader);
                        libKey.Add(header);

                        if (reader.Name == "atts" || reader.ReadToNextSibling("atts"))
                        {
                            List<LibDetail> libD = new List<LibDetail>();
                            if (reader.ReadToDescendant("att"))
                            {
                                LibDetail detail = new LibDetail();
                                detail.FromXml(reader);
                                libD.Add(detail);
                            }
                            while (reader.ReadToNextSibling("att"))
                            {
                                LibDetail detail = new LibDetail();
                                detail.FromXml(reader);
                                libD.Add(detail);
                            }
                            header.Details = libD;
                        }
                    }
                }
            }

            UserModel userMdl = new UserModel();
            if (userMdl.SignIn(_Name, pass, code))
            {
                userMdl.View = view;
                userMdl.LibKey = libKey;

                _Main.ShowUser();

                Awin mpwd = new Awin(userMdl);
                mpwd.InitView(_Main);
                mpwd.InitData();
            }
        }
Ejemplo n.º 4
0
        public PdfEditor(UserModel userModel)
        {
            _UserModel = userModel;

            InitializeComponent();
        }
Ejemplo n.º 5
0
        private void SignUp(HttpContext context, XmlWriter writer)
        {
            string t = context.Request["t"];
            if (!CharUtil.IsValidateHash(t))
            {
                SendError(writer, "无效的句柄!");
                return;
            }
            string d = context.Request["d"];
            if (!CharUtil.IsValidate(d))
            {
                SendError(writer, "无效的密文!");
                return;
            }

            d = Decrypt(t, HttpUtil.FromBase64String(d));
            string[] tmp = d.Split('\n');
            if (tmp.Length != 3)
            {
                SendError(writer, "无效的密文!");
                return;
            }

            string name = HttpUtil.Text2Db(tmp[0]);
            string mail = HttpUtil.Text2Db(tmp[1]);
            string pass = tmp[2];
            UserModel model = new UserModel();
            if (IMsg.MSG_SIGNUP_SUCCESS != model.WpSignUp(name, pass, mail))
            {
                SendError(writer, "系统处理异常,请稍后重试!");
                return;
            }

            model.InitUserData();

            writer.WriteStartElement("User");
            model.WsSignUp(name, pass, writer);
            writer.WriteEndElement();
        }
Ejemplo n.º 6
0
        private void SignPk(HttpContext context, XmlWriter writer)
        {
            string t = context.Request["t"];
            if (!CharUtil.IsValidateHash(t))
            {
                SendError(writer, "无效的句柄!");
                return;
            }
            string d = context.Request["d"];
            if (!CharUtil.IsValidate(d))
            {
                SendError(writer, "无效的密文!");
                return;
            }

            d = Decrypt(t, HttpUtil.FromBase64String(d));
            string[] tmp = d.Split('\n');
            if (tmp.Length != 3)
            {
                SendError(writer, "无效的密文!");
                return;
            }

            string name = HttpUtil.Text2Db(tmp[0]);
            string oldPass = tmp[1];
            string newPass = tmp[2];
            UserModel userModel = new UserModel();
            userModel.WpSignPk(oldPass, newPass);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="userModel"></param>
 public SafeModel(UserModel userModel)
 {
     _UserModel = userModel;
 }