update 允许手机号/邮箱

This commit is contained in:
2021-07-02 20:17:41 +08:00
parent 36a9964899
commit 63374ac2c8
9 changed files with 55 additions and 13 deletions

View File

@@ -136,10 +136,10 @@ namespace Ewide.Core.Service
var encryptPasswod = MD5Encryption.Encrypt(password); var encryptPasswod = MD5Encryption.Encrypt(password);
#if DEBUG #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 #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); _ = user ?? throw Oops.Oh(ErrorCode.D1000);
#endif #endif

View File

@@ -111,7 +111,21 @@ namespace Ewide.Core.Service
// 数据范围检查 // 数据范围检查
await CheckDataScope(input); 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); if (isExist) throw Oops.Oh(ErrorCode.D1003);
input.Password = CommonConst.DEFAULT_PASSWORD; input.Password = CommonConst.DEFAULT_PASSWORD;
var user = input.Adapt<SysUser>(); var user = input.Adapt<SysUser>();
@@ -171,8 +185,22 @@ namespace Ewide.Core.Service
// 数据范围检查 // 数据范围检查
await CheckDataScope(input); 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); if (isExist) throw Oops.Oh(ErrorCode.D1003);
var user = input.Adapt<SysUser>(); var user = input.Adapt<SysUser>();

View File

@@ -36,3 +36,6 @@
width: 26px; width: 26px;
height: 26px; height: 26px;
} }
.ant-modal-mask {
backdrop-filter: blur(3px);
}

View File

@@ -46,7 +46,7 @@
padding: @padding-lg; padding: @padding-lg;
border-radius: @border-radius-base + 2px; 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 { .ant-form-item {
margin-bottom: 0; margin-bottom: 0;
@@ -59,7 +59,7 @@
>label { >label {
font-weight: normal !important; font-weight: normal !important;
color: fade(@black, 40%); color: fade(@white, 40%);
} }
} }
&--label { &--label {
@@ -69,9 +69,9 @@
} }
.ant-input, .ant-input,
.ant-input-affix-wrapper { .ant-input-affix-wrapper {
color: fade(@black, 85%); color: fade(@white, 85%);
border-width: 0 0 @border-width-base 0 !important; border-width: 0 0 @border-width-base 0 !important;
border-color: fade(@black, 10%); border-color: fade(@white, 10%);
background-color: transparent; background-color: transparent;
} }
.ant-input:hover, .ant-input:hover,
@@ -83,4 +83,7 @@
border-color: @primary-color; border-color: @primary-color;
box-shadow: none !important; box-shadow: none !important;
} }
.ant-input::placeholder {
font-size: @font-size-base;
}
} }

View File

@@ -36,3 +36,6 @@
width: 26px; width: 26px;
height: 26px; height: 26px;
} }
.ant-modal-mask {
backdrop-filter: blur(3px);
}

View File

@@ -46,7 +46,7 @@
padding: @padding-lg; padding: @padding-lg;
border-radius: @border-radius-base + 2px; 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 { .ant-form-item {
margin-bottom: 0; margin-bottom: 0;
@@ -83,4 +83,7 @@
border-color: @primary-color; border-color: @primary-color;
box-shadow: none !important; box-shadow: none !important;
} }
.ant-input::placeholder {
font-size: @font-size-base;
}
} }

View File

@@ -183,10 +183,10 @@ export default class index extends Component {
/** /**
* 删除 * 删除
* @param {*} record * @param {*} id
*/ */
onDelete(record) { onDelete(id) {
this.onAction(apiAction.delete(record), '删除成功') this.onAction(apiAction.delete({ id }), '删除成功')
} }
//#region 自定义方法 //#region 自定义方法

View File

@@ -142,6 +142,7 @@ export default class index extends Component {
}} }}
size="large" size="large"
autoComplete="off" autoComplete="off"
placeholder={focusUser && '请输入用户名/手机号/邮箱'}
/> />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
@@ -162,6 +163,7 @@ export default class index extends Component {
}} }}
size="large" size="large"
autoComplete="off" autoComplete="off"
placeholder={focusPassword && '请输入密码'}
/> />
</Form.Item> </Form.Item>
<Form.Item className="mt-lg"> <Form.Item className="mt-lg">

View File

@@ -122,7 +122,7 @@ export default class notice extends Component {
> >
<span className="header-action"> <span className="header-action">
<Badge count={count}> <Badge count={count}>
<AntIcon type="bell" /> <AntIcon type="message" />
</Badge> </Badge>
</span> </span>