|
|
@ -15,6 +15,7 @@ using System.IO;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using Yitter.IdGenerator;
|
|
|
|
using Yitter.IdGenerator;
|
|
|
|
|
|
|
|
using Furion;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Core.Service;
|
|
|
|
namespace Myshipping.Core.Service;
|
|
|
|
|
|
|
|
|
|
|
@ -97,9 +98,10 @@ public class SysUserService : ISysUserService, IDynamicApiController, ITransient
|
|
|
|
var isExist = await _sysUserRep.AnyAsync(u => u.Account == input.Account);
|
|
|
|
var isExist = await _sysUserRep.AnyAsync(u => u.Account == input.Account);
|
|
|
|
if (isExist) throw Oops.Oh(ErrorCode.D1003);
|
|
|
|
if (isExist) throw Oops.Oh(ErrorCode.D1003);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var keyDES = App.GetOptions<EncryptKeyOptions>().DES;
|
|
|
|
var user = input.Adapt<SysUser>();
|
|
|
|
var user = input.Adapt<SysUser>();
|
|
|
|
user.AdminType = AdminType.None;
|
|
|
|
user.AdminType = AdminType.None;
|
|
|
|
user.Password = MD5Encryption.Encrypt(input.Password);
|
|
|
|
user.Password = DESCEncryption.Encrypt(input.Password, keyDES);
|
|
|
|
if (string.IsNullOrEmpty(user.Name))
|
|
|
|
if (string.IsNullOrEmpty(user.Name))
|
|
|
|
user.Name = user.Account;
|
|
|
|
user.Name = user.Account;
|
|
|
|
if (string.IsNullOrEmpty(user.NickName))
|
|
|
|
if (string.IsNullOrEmpty(user.NickName))
|
|
|
@ -297,10 +299,11 @@ public class SysUserService : ISysUserService, IDynamicApiController, ITransient
|
|
|
|
[HttpPost("/sysUser/updatePwd")]
|
|
|
|
[HttpPost("/sysUser/updatePwd")]
|
|
|
|
public async Task UpdateUserPwd(ChangePasswordUserInput input)
|
|
|
|
public async Task UpdateUserPwd(ChangePasswordUserInput input)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
var keyDES = App.GetOptions<EncryptKeyOptions>().DES;
|
|
|
|
var user = await _sysUserRep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
|
|
var user = await _sysUserRep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
|
|
if (MD5Encryption.Encrypt(input.Password) != user.Password)
|
|
|
|
if (DESCEncryption.Encrypt(input.Password, keyDES) != user.Password)
|
|
|
|
throw Oops.Oh(ErrorCode.D1004);
|
|
|
|
throw Oops.Oh(ErrorCode.D1004);
|
|
|
|
user.Password = MD5Encryption.Encrypt(input.NewPassword);
|
|
|
|
user.Password = DESCEncryption.Encrypt(input.NewPassword, keyDES);
|
|
|
|
await _sysUserRep.AsUpdateable(user).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
await _sysUserRep.AsUpdateable(user).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -334,8 +337,9 @@ public class SysUserService : ISysUserService, IDynamicApiController, ITransient
|
|
|
|
[HttpPost("/sysUser/resetPwd")]
|
|
|
|
[HttpPost("/sysUser/resetPwd")]
|
|
|
|
public async Task ResetUserPwd(QueryUserInput input)
|
|
|
|
public async Task ResetUserPwd(QueryUserInput input)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
var keyDES = App.GetOptions<EncryptKeyOptions>().DES;
|
|
|
|
var user = await _sysUserRep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
|
|
var user = await _sysUserRep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
|
|
user.Password = MD5Encryption.Encrypt(await _sysConfigService.GetDefaultPassword());
|
|
|
|
user.Password = DESCEncryption.Encrypt(await _sysConfigService.GetDefaultPassword(), keyDES);
|
|
|
|
await _sysUserRep.AsUpdateable(user).IgnoreColumns(it => new { it.AdminType }).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
await _sysUserRep.AsUpdateable(user).IgnoreColumns(it => new { it.AdminType }).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|