增加功能:增加忘记密码按钮调用后台api接口
This commit is contained in:
parent
e27c673e92
commit
b93d1fca79
|
@ -26,6 +26,7 @@ namespace Bootstrap.Admin.Controllers.Api
|
|||
{
|
||||
return UserHelper.RetrieveUserByUserName(userName) == null && !UserHelper.RetrieveNewUsers().Any(u => u.UserName == userName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录页面注册新用户提交按钮调用
|
||||
/// </summary>
|
||||
|
@ -39,5 +40,16 @@ namespace Bootstrap.Admin.Controllers.Api
|
|||
if (ret) await SignalRManager.Send(hub.Clients.All, new MessageBody() { Category = "Users", Message = string.Format("{0}-{1}", user.UserName, user.Description) });
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 忘记密码调用
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
public bool Put([FromBody]User user)
|
||||
{
|
||||
return UserHelper.ForgotPassword(user.UserName, user.DisplayName, user.Description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,19 @@
|
|||
});
|
||||
});
|
||||
|
||||
$('#btnForgot').on('click', function () {
|
||||
$.bc({
|
||||
url: "api/Register",
|
||||
data: { UserName: $('#f_userName').val(), DisplayName: $('#f_displayName').val(), Description: $('#f_desc').val() },
|
||||
modal: '#dialogForgot',
|
||||
method: "put",
|
||||
callback: function (result) {
|
||||
var title = result ? "提交成功<br/>等待管理员重置密码" : "提交失败";
|
||||
lgbSwal({ timer: 1500, title: title, type: result ? "success" : "error" });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.rememberPwd').on('click', function () {
|
||||
var $this = $(this);
|
||||
var $check = $this.find('i');
|
||||
|
|
|
@ -96,6 +96,19 @@ namespace Bootstrap.DataAccess
|
|||
/// <returns></returns>
|
||||
public static bool ChangePassword(string userName, string password, string newPass) => DbContextManager.Create<User>().ChangePassword(userName, password, newPass);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="userName"></param>
|
||||
/// <param name="displayName"></param>
|
||||
/// <param name="desc"></param>
|
||||
/// <returns></returns>
|
||||
public static bool ForgotPassword(string userName, string displayName, string desc)
|
||||
{
|
||||
// UNDONE 忘记密码涉及到安全问题,防止用户恶意重置其他用户,待定
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue