update 允许手机号/邮箱
This commit is contained in:
@@ -136,10 +136,10 @@ namespace Ewide.Core.Service
|
||||
var encryptPasswod = MD5Encryption.Encrypt(password);
|
||||
|
||||
#if DEBUG
|
||||
var user = await _sysUserRep.FirstOrDefaultAsync(u => u.Account.Equals(input.Account));
|
||||
var user = await _sysUserRep.FirstOrDefaultAsync(u => u.Account.Equals(input.Account) || u.Phone.Equals(input.Account) || u.Email.Equals(input.Account));
|
||||
#else
|
||||
// 判断用户名和密码是否正确
|
||||
var user = await _sysUserRep.FirstOrDefaultAsync(u => u.Account.Equals(input.Account) && u.Password.Equals(encryptPasswod));
|
||||
var user = await _sysUserRep.FirstOrDefaultAsync(u => (u.Account.Equals(input.Account) || u.Phone.Equals(input.Account) || u.Email.Equals(input.Account)) && u.Password.Equals(encryptPasswod));
|
||||
_ = user ?? throw Oops.Oh(ErrorCode.D1000);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -111,7 +111,21 @@ namespace Ewide.Core.Service
|
||||
// 数据范围检查
|
||||
await CheckDataScope(input);
|
||||
|
||||
var isExist = await _sysUserRep.AnyAsync(u => u.Account == input.Account, false);
|
||||
var email = input.Email?.ToLower();
|
||||
|
||||
var isExist = await _sysUserRep.AnyAsync(u =>
|
||||
input.Account.Equals(u.Account) ||
|
||||
input.Account.Equals(u.Phone) ||
|
||||
input.Account.Equals(u.Email) ||
|
||||
(!string.IsNullOrWhiteSpace(input.Phone) && (
|
||||
input.Phone.Equals(u.Account) ||
|
||||
input.Phone.Equals(u.Phone)
|
||||
)) ||
|
||||
(!string.IsNullOrWhiteSpace(email) && (
|
||||
email.Equals(u.Account) ||
|
||||
email.Equals(u.Email)
|
||||
))
|
||||
, false);
|
||||
if (isExist) throw Oops.Oh(ErrorCode.D1003);
|
||||
input.Password = CommonConst.DEFAULT_PASSWORD;
|
||||
var user = input.Adapt<SysUser>();
|
||||
@@ -171,8 +185,22 @@ namespace Ewide.Core.Service
|
||||
// 数据范围检查
|
||||
await CheckDataScope(input);
|
||||
|
||||
var email = input.Email?.ToLower();
|
||||
|
||||
// 排除自己并且判断与其他是否相同
|
||||
var isExist = await _sysUserRep.AnyAsync(u => u.Account == input.Account && u.Id != input.Id, false);
|
||||
var isExist = await _sysUserRep.AnyAsync(u =>
|
||||
(input.Account.Equals(u.Account) && !input.Id.Equals(u.Id)) ||
|
||||
input.Account.Equals(u.Phone) ||
|
||||
input.Account.Equals(u.Email) ||
|
||||
(!string.IsNullOrWhiteSpace(input.Phone) && (
|
||||
input.Phone.Equals(u.Account) ||
|
||||
(input.Phone.Equals(u.Phone) && !input.Id.Equals(u.Id))
|
||||
)) ||
|
||||
(!string.IsNullOrWhiteSpace(email) && (
|
||||
email.Equals(u.Account) ||
|
||||
(email.Equals(u.Email) && !input.Id.Equals(u.Id))
|
||||
))
|
||||
, false);
|
||||
if (isExist) throw Oops.Oh(ErrorCode.D1003);
|
||||
|
||||
var user = input.Adapt<SysUser>();
|
||||
|
||||
@@ -36,3 +36,6 @@
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
}
|
||||
.ant-modal-mask {
|
||||
backdrop-filter: blur(3px);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
padding: @padding-lg;
|
||||
|
||||
border-radius: @border-radius-base + 2px;
|
||||
background: linear-gradient(45deg, @white, fade(@white, 80%));
|
||||
background: linear-gradient(45deg, @component-background, fade(@component-background, 80%));
|
||||
}
|
||||
.ant-form-item {
|
||||
margin-bottom: 0;
|
||||
@@ -59,7 +59,7 @@
|
||||
>label {
|
||||
font-weight: normal !important;
|
||||
|
||||
color: fade(@black, 40%);
|
||||
color: fade(@white, 40%);
|
||||
}
|
||||
}
|
||||
&--label {
|
||||
@@ -69,9 +69,9 @@
|
||||
}
|
||||
.ant-input,
|
||||
.ant-input-affix-wrapper {
|
||||
color: fade(@black, 85%);
|
||||
color: fade(@white, 85%);
|
||||
border-width: 0 0 @border-width-base 0 !important;
|
||||
border-color: fade(@black, 10%);
|
||||
border-color: fade(@white, 10%);
|
||||
background-color: transparent;
|
||||
}
|
||||
.ant-input:hover,
|
||||
@@ -83,4 +83,7 @@
|
||||
border-color: @primary-color;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
.ant-input::placeholder {
|
||||
font-size: @font-size-base;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,3 +36,6 @@
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
}
|
||||
.ant-modal-mask {
|
||||
backdrop-filter: blur(3px);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
padding: @padding-lg;
|
||||
|
||||
border-radius: @border-radius-base + 2px;
|
||||
background: linear-gradient(45deg, @white, fade(@white, 80%));
|
||||
background: linear-gradient(45deg, @component-background, fade(@component-background, 80%));
|
||||
}
|
||||
.ant-form-item {
|
||||
margin-bottom: 0;
|
||||
@@ -83,4 +83,7 @@
|
||||
border-color: @primary-color;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
.ant-input::placeholder {
|
||||
font-size: @font-size-base;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,10 +183,10 @@ export default class index extends Component {
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param {*} record
|
||||
* @param {*} id
|
||||
*/
|
||||
onDelete(record) {
|
||||
this.onAction(apiAction.delete(record), '删除成功')
|
||||
onDelete(id) {
|
||||
this.onAction(apiAction.delete({ id }), '删除成功')
|
||||
}
|
||||
|
||||
//#region 自定义方法
|
||||
|
||||
@@ -142,6 +142,7 @@ export default class index extends Component {
|
||||
}}
|
||||
size="large"
|
||||
autoComplete="off"
|
||||
placeholder={focusUser && '请输入用户名/手机号/邮箱'}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
@@ -162,6 +163,7 @@ export default class index extends Component {
|
||||
}}
|
||||
size="large"
|
||||
autoComplete="off"
|
||||
placeholder={focusPassword && '请输入密码'}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item className="mt-lg">
|
||||
|
||||
@@ -122,7 +122,7 @@ export default class notice extends Component {
|
||||
>
|
||||
<span className="header-action">
|
||||
<Badge count={count}>
|
||||
<AntIcon type="bell" />
|
||||
<AntIcon type="message" />
|
||||
</Badge>
|
||||
</span>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user