コード例 #1
0
        public OutputData Update(IInputData input, object instance)
        {
            BasePasswordData passwd = instance.Convert <BasePasswordData>();

            InternalAccount account = new InternalAccount(passwd.UserId, passwd.Password);

            account.Update();

            return(OutputData.CreateToolkitObject(KeyData.Empty));
        }
コード例 #2
0
        public OutputData Update(IInputData input, object instance)
        {
            BasePasswordData passwd = instance.Convert <BasePasswordData>();

            using (EmptyDbDataSource source = new EmptyDbDataSource())
                using (UserResolver resolver = new UserResolver(source))
                {
                    return(ChangePasswd(resolver, passwd));
                }
        }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
 protected override OutputData ChangePasswd(UserResolver resolver, BasePasswordData passwd)
 {
     resolver.ChangePassword(passwd.UserId,
         passwd.GetNewPassword("PasswordData"), null);
     return OutputData.CreateToolkitObject(resolver.CreateKeyData());
 }
コード例 #6
0
 protected abstract OutputData ChangePasswd(UserResolver resolver, BasePasswordData passwd);
コード例 #7
0
 protected override OutputData ChangePasswd(UserResolver resolver, BasePasswordData passwd)
 {
     resolver.ChangePassword(passwd.UserId,
                             passwd.GetNewPassword("PasswordData"), null);
     return(OutputData.CreateToolkitObject(resolver.CreateKeyData()));
 }
コード例 #8
0
 protected abstract OutputData ChangePasswd(UserResolver resolver, BasePasswordData passwd);