Exemplo n.º 1
0
        public string GetNewPassword(string tableName)
        {
            if (Password == ConfirmPassword)
            {
                return(Password);
            }
            const string   errorMsg = "新密码与确认密码不匹配";
            FieldErrorInfo info     = new FieldErrorInfo(tableName, "Password", errorMsg);

            throw new WebPostException(errorMsg, info);
        }
Exemplo n.º 2
0
 public string GetNewPassword(string tableName)
 {
     if (Password == ConfirmPassword)
     {
         if (Password == string.Empty)
         {
             throw new WebPostException("密码不能为空", new FieldErrorInfo(tableName, "Password", "登录密码不能为空"));
         }
         else
             return this.Password;
     }
     FieldErrorInfo info = new FieldErrorInfo(tableName, "Password", "登录密码与确认密码不匹配");
     throw new WebPostException("登录密码与确认密码不匹配", info);
 }
 protected override OutputData ChangePasswd(UserResolver resolver, BasePasswordData passwd)
 {
     PasswordData password = passwd.Convert<PasswordData>();
     bool success = resolver.ChangePassword(passwd.UserId, passwd.GetNewPassword("PasswordData"),
         password.OldPassword);
     if (success)
         return OutputData.CreateToolkitObject(resolver.CreateKeyData());
     else
     {
         const string errorMsg = "原密码不匹配";
         FieldErrorInfo field = new FieldErrorInfo("PasswordData", "OldPassword", errorMsg);
         throw new WebPostException(errorMsg, field);
     }
 }
Exemplo n.º 4
0
        public string GetNewPassword(string tableName)
        {
            if (Password == ConfirmPassword)
            {
                if (Password == string.Empty)
                {
                    throw new WebPostException("密码不能为空", new FieldErrorInfo(tableName, "Password", "登录密码不能为空"));
                }
                else
                {
                    return(this.Password);
                }
            }
            FieldErrorInfo info = new FieldErrorInfo(tableName, "Password", "登录密码与确认密码不匹配");

            throw new WebPostException("登录密码与确认密码不匹配", info);
        }
        protected override OutputData ChangePasswd(UserResolver resolver, BasePasswordData passwd)
        {
            PasswordData password = passwd.Convert <PasswordData>();
            bool         success  = resolver.ChangePassword(passwd.UserId, passwd.GetNewPassword("PasswordData"),
                                                            password.OldPassword);

            if (success)
            {
                return(OutputData.CreateToolkitObject(resolver.CreateKeyData()));
            }
            else
            {
                const string   errorMsg = "原密码不匹配";
                FieldErrorInfo field    = new FieldErrorInfo("PasswordData", "OldPassword", errorMsg);
                throw new WebPostException(errorMsg, field);
            }
        }
Exemplo n.º 6
0
        public void CheckPostDataSet(TkDbContext context, IInputData inputData,
                                     string tableName, FieldErrorInfoCollection errorObjects)
        {
            DataSet   ds    = inputData.PostObject.Convert <DataSet>();
            DataTable table = ds.Tables[tableName];

            if (table == null)
            {
                return;
            }

            foreach (BaseConstraint constraint in fList)
            {
                string fieldName = constraint.Field.NickName;
                if (!table.Columns.Contains(fieldName))
                {
                    if (constraint.CoerceCheck)
                    {
                        constraint.InternalCheckError(inputData, null, -1, context);
                    }
                    continue;
                }

                int i = 0;
                foreach (DataRow row in table.Rows)
                {
                    if (row.RowState == DataRowState.Deleted)
                    {
                        ++i;
                        continue;
                    }
                    string value = row[fieldName].ToString();
                    if (!errorObjects.Contains(constraint, i))
                    {
                        FieldErrorInfo error = constraint.InternalCheckError(inputData, value, i,
                                                                             context, row, table, ds);
                        if (error != null)
                        {
                            errorObjects.Add(constraint, error, i);
                        }
                    }
                    ++i;
                }
            }
        }
Exemplo n.º 7
0
        private static WebPostException CreateException(string message)
        {
            FieldErrorInfo field = new FieldErrorInfo("LogOnData", "LogOnName", message);

            return(new WebPostException(message, field));
        }