<develop>:(ShopERP 端)<无> 找回密码 功能完善。

parent 9770e1bc
......@@ -152,14 +152,14 @@ namespace CoreCms.Net.Model.FromBody
public string phone { get; set; }
public string userEmail { get; set; }
public string email { get; set; }
public string passWord { get; set; }
/// <summary>
/// 验证码
/// </summary>
public string VerifyCode { get; set; }
public string validCode { get; set; }
......
......@@ -349,7 +349,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
/// </summary>
/// <param name="email"></param>
/// <param name="verificationCode"></param>
public async void SendVerificationEmailAsync(string email, string verificationCode)
private async void SendVerificationEmailAsync(string email, string verificationCode)
{
var message = new MailMessageModel()
{
......@@ -385,15 +385,14 @@ namespace CoreCms.Net.Web.Admin.Controllers
#endregion
#region 重置密码============================================================
// POST: api/login/DoResetPassword
// POST: api/login/ResetPassword
/// <summary>
/// 重置密码
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
[HttpPost]
[Description("重置密码")]
public async Task<AdminUiCallBack> DoResetPassword([FromBody] FMSendResetPasswordPost param)
public async Task<AdminUiCallBack> ResetPassword([FromBody] FMSendResetPasswordPost param)
{
var jm = new AdminUiCallBack();
......@@ -403,10 +402,10 @@ namespace CoreCms.Net.Web.Admin.Controllers
return jm;
}
var isHave = await _sysUserServices.ExistsAsync(p => p.phone == param.phone);
if (isHave)
var entity = await _sysUserServices.QueryByClauseAsync(p => p.userName == param.userName&&p.email==param.email);
if (entity == null)
{
jm.msg = "已存在此手机号码";
jm.msg = "用户工号与邮箱不匹配!";
return jm;
}
......@@ -415,24 +414,23 @@ namespace CoreCms.Net.Web.Admin.Controllers
string dbVerifyCode=_redisOperationRepository.Get(strCacheKey).Result;
if (!dbVerifyCode.Equals(param.VerifyCode))
if (!dbVerifyCode.Equals(param.validCode))
{
jm.msg = "验证码错误!";
return jm;
}
SysUser entity = new SysUser();
entity.userName = param.userName;
entity.passWord = CommonHelper.Md5For32(param.passWord);
entity.sex = 0;
entity.phone = param.phone;
entity.email = param.userEmail;
entity.email = param.email;
entity.createTime = DateTime.Now;
entity.updateTime = DateTime.Now;
var bl = await _sysUserServices.UpdateAsync(entity);
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
jm.msg = bl ? GlobalConstVars.OperSuccess : GlobalConstVars.OperFailure;
return jm;
}
......
......@@ -570,7 +570,7 @@
<param name="email"></param>
<param name="verificationCode"></param>
</member>
<member name="M:CoreCms.Net.Web.Admin.Controllers.LoginController.DoResetPassword(CoreCms.Net.Model.FromBody.FMSendResetPasswordPost)">
<member name="M:CoreCms.Net.Web.Admin.Controllers.LoginController.ResetPassword(CoreCms.Net.Model.FromBody.FMSendResetPasswordPost)">
<summary>
重置密码
</summary>
......
......@@ -570,7 +570,7 @@
<param name="email"></param>
<param name="verificationCode"></param>
</member>
<member name="M:CoreCms.Net.Web.Admin.Controllers.LoginController.DoResetPassword(CoreCms.Net.Model.FromBody.FMSendResetPasswordPost)">
<member name="M:CoreCms.Net.Web.Admin.Controllers.LoginController.ResetPassword(CoreCms.Net.Model.FromBody.FMSendResetPasswordPost)">
<summary>
重置密码
</summary>
......
......@@ -160,7 +160,7 @@
shadeClose: false,
title: '忘记密码',
area: ['430px', '500px'],
id: 'LAY-popup-CoreCmsUser-register',
id: 'LAY-popup-CoreCmsUser-ResetPassword',
success: function (layero, index) {
view(this.id).render('user/userInfo/forgetPassword', { data: 'forgetPassword' }).done(function () {
//监听提交
......@@ -170,8 +170,13 @@
var field = data.field; //获取提交的字段
field.isDelete = field.isDelete == 'on';
// 在公共文件中定义
const API = {
RESET_PWD: "api/login/ResetPassword"
};
//提交 Ajax 成功后,关闭当前弹层并重载表格
coreHelper.Post("api/login/DoResetPassword​​ ", field, function (e) {
coreHelper.Post(API.RESET_PWD,field,function (e) {
console.log(e)
if (e.code === 0) {
......
......@@ -87,17 +87,18 @@
//用户工号
var strUserName = $("#userName").val();
var $email = $('#email');
//发送验证码功能
var strUserEmail = $("#email").val();
// 如果没有错误,则验证通过
var errorEmail = form.validate($("#email"));
if (errorEmail) {
return; // 验证不通过,自动显示错误信息
}
const isAllValid = form.validate($email);
if (!isAllValid) return;
var currentTime = new Date().getTime();
//提交 Ajax 到后台 (判断工号 与 邮箱是否匹配)
coreHelper.Post("api/login/DoSendValidCode", { userName: strUserName, userEmail: strUserEmail }, function (e) {
coreHelper.Post("api/login/DoSendValidCode", { userName: strUserName, userEmail: strUserEmail, currentTime: currentTime }, function (e) {
console.log(e)
if (e.code === 0) {
layer.msg(e.msg);
......
{
"runtimeOptions": {
"tfm": "net8.0",
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
{
"name": "Microsoft.AspNetCore.App",
"version": "8.0.0"
}
],
"configProperties": {
"System.GC.Server": true,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
\ No newline at end of file
{"Version":1,"ManifestType":"Build","Endpoints":[{"Route":"favicon.62a6qbxtiu.ico","AssetFile":"favicon.ico","Selectors":[],"ResponseHeaders":[{"Name":"Accept-Ranges","Value":"bytes"},{"Name":"Cache-Control","Value":"max-age=31536000, immutable"},{"Name":"Content-Length","Value":"67646"},{"Name":"Content-Type","Value":"image/x-icon"},{"Name":"ETag","Value":"\"bi58/A8mtYFE9PbRECPK+RtrUVpYWcrVQlZLpLZLROA=\""},{"Name":"Last-Modified","Value":"Mon, 13 Jan 2025 01:25:52 GMT"}],"EndpointProperties":[{"Name":"fingerprint","Value":"62a6qbxtiu"},{"Name":"integrity","Value":"sha256-bi58/A8mtYFE9PbRECPK+RtrUVpYWcrVQlZLpLZLROA="},{"Name":"label","Value":"favicon.ico"}]},{"Route":"favicon.ico","AssetFile":"favicon.ico","Selectors":[],"ResponseHeaders":[{"Name":"Accept-Ranges","Value":"bytes"},{"Name":"Cache-Control","Value":"no-cache"},{"Name":"Content-Length","Value":"67646"},{"Name":"Content-Type","Value":"image/x-icon"},{"Name":"ETag","Value":"\"bi58/A8mtYFE9PbRECPK+RtrUVpYWcrVQlZLpLZLROA=\""},{"Name":"Last-Modified","Value":"Mon, 13 Jan 2025 01:25:52 GMT"}],"EndpointProperties":[{"Name":"integrity","Value":"sha256-bi58/A8mtYFE9PbRECPK+RtrUVpYWcrVQlZLpLZLROA="}]},{"Route":"fonts/SourceHanSansK-Normal.l47xgl9o8w.ttf","AssetFile":"fonts/SourceHanSansK-Normal.ttf","Selectors":[],"ResponseHeaders":[{"Name":"Accept-Ranges","Value":"bytes"},{"Name":"Cache-Control","Value":"max-age=31536000, immutable"},{"Name":"Content-Length","Value":"17129372"},{"Name":"Content-Type","Value":"application/x-font-ttf"},{"Name":"ETag","Value":"\"q0kZJ8h5OBWrbgHsDCkoFixJMRxQSQ8orHdo/bfHoLw=\""},{"Name":"Last-Modified","Value":"Mon, 13 Jan 2025 01:25:52 GMT"}],"EndpointProperties":[{"Name":"fingerprint","Value":"l47xgl9o8w"},{"Name":"integrity","Value":"sha256-q0kZJ8h5OBWrbgHsDCkoFixJMRxQSQ8orHdo/bfHoLw="},{"Name":"label","Value":"fonts/SourceHanSansK-Normal.ttf"}]},{"Route":"fonts/SourceHanSansK-Normal.ttf","AssetFile":"fonts/SourceHanSansK-Normal.ttf","Selectors":[],"ResponseHeaders":[{"Name":"Accept-Ranges","Value":"bytes"},{"Name":"Cache-Control","Value":"no-cache"},{"Name":"Content-Length","Value":"17129372"},{"Name":"Content-Type","Value":"application/x-font-ttf"},{"Name":"ETag","Value":"\"q0kZJ8h5OBWrbgHsDCkoFixJMRxQSQ8orHdo/bfHoLw=\""},{"Name":"Last-Modified","Value":"Mon, 13 Jan 2025 01:25:52 GMT"}],"EndpointProperties":[{"Name":"integrity","Value":"sha256-q0kZJ8h5OBWrbgHsDCkoFixJMRxQSQ8orHdo/bfHoLw="}]},{"Route":"index.g5ax0ezka6.html","AssetFile":"index.html","Selectors":[],"ResponseHeaders":[{"Name":"Accept-Ranges","Value":"bytes"},{"Name":"Cache-Control","Value":"max-age=31536000, immutable"},{"Name":"Content-Length","Value":"3187"},{"Name":"Content-Type","Value":"text/html"},{"Name":"ETag","Value":"\"XCZ1N4gbD6XeRVMeCkqt7HZxEXbOfp+hKxcshDnTW/I=\""},{"Name":"Last-Modified","Value":"Tue, 01 Jul 2025 10:40:28 GMT"}],"EndpointProperties":[{"Name":"fingerprint","Value":"g5ax0ezka6"},{"Name":"integrity","Value":"sha256-XCZ1N4gbD6XeRVMeCkqt7HZxEXbOfp+hKxcshDnTW/I="},{"Name":"label","Value":"index.html"}]},{"Route":"index.html","AssetFile":"index.html","Selectors":[],"ResponseHeaders":[{"Name":"Accept-Ranges","Value":"bytes"},{"Name":"Cache-Control","Value":"no-cache"},{"Name":"Content-Length","Value":"3187"},{"Name":"Content-Type","Value":"text/html"},{"Name":"ETag","Value":"\"XCZ1N4gbD6XeRVMeCkqt7HZxEXbOfp+hKxcshDnTW/I=\""},{"Name":"Last-Modified","Value":"Tue, 01 Jul 2025 10:40:28 GMT"}],"EndpointProperties":[{"Name":"integrity","Value":"sha256-XCZ1N4gbD6XeRVMeCkqt7HZxEXbOfp+hKxcshDnTW/I="}]},{"Route":"robots.gnxm88p04n.txt","AssetFile":"robots.txt","Selectors":[],"ResponseHeaders":[{"Name":"Accept-Ranges","Value":"bytes"},{"Name":"Cache-Control","Value":"max-age=31536000, immutable"},{"Name":"Content-Length","Value":"27"},{"Name":"Content-Type","Value":"text/plain"},{"Name":"ETag","Value":"\"3AurSXwfp3NYMN2aidzjseebDvi0SoT+nQnWxjEwlZM=\""},{"Name":"Last-Modified","Value":"Mon, 13 Jan 2025 01:25:52 GMT"}],"EndpointProperties":[{"Name":"fingerprint","Value":"gnxm88p04n"},{"Name":"integrity","Value":"sha256-3AurSXwfp3NYMN2aidzjseebDvi0SoT+nQnWxjEwlZM="},{"Name":"label","Value":"robots.txt"}]},{"Route":"robots.txt","AssetFile":"robots.txt","Selectors":[],"ResponseHeaders":[{"Name":"Accept-Ranges","Value":"bytes"},{"Name":"Cache-Control","Value":"no-cache"},{"Name":"Content-Length","Value":"27"},{"Name":"Content-Type","Value":"text/plain"},{"Name":"ETag","Value":"\"3AurSXwfp3NYMN2aidzjseebDvi0SoT+nQnWxjEwlZM=\""},{"Name":"Last-Modified","Value":"Mon, 13 Jan 2025 01:25:52 GMT"}],"EndpointProperties":[{"Name":"integrity","Value":"sha256-3AurSXwfp3NYMN2aidzjseebDvi0SoT+nQnWxjEwlZM="}]},{"Route":"static/images/logo.g9zxsafz3u.png","AssetFile":"static/images/logo.png","Selectors":[],"ResponseHeaders":[{"Name":"Accept-Ranges","Value":"bytes"},{"Name":"Cache-Control","Value":"max-age=31536000, immutable"},{"Name":"Content-Length","Value":"129543"},{"Name":"Content-Type","Value":"image/png"},{"Name":"ETag","Value":"\"PBswfbsKasu255N70ciyAZXbp1C+MVfjI3wJ8oNVPuk=\""},{"Name":"Last-Modified","Value":"Mon, 13 Jan 2025 01:25:52 GMT"}],"EndpointProperties":[{"Name":"fingerprint","Value":"g9zxsafz3u"},{"Name":"integrity","Value":"sha256-PBswfbsKasu255N70ciyAZXbp1C+MVfjI3wJ8oNVPuk="},{"Name":"label","Value":"static/images/logo.png"}]},{"Route":"static/images/logo.png","AssetFile":"static/images/logo.png","Selectors":[],"ResponseHeaders":[{"Name":"Accept-Ranges","Value":"bytes"},{"Name":"Cache-Control","Value":"no-cache"},{"Name":"Content-Length","Value":"129543"},{"Name":"Content-Type","Value":"image/png"},{"Name":"ETag","Value":"\"PBswfbsKasu255N70ciyAZXbp1C+MVfjI3wJ8oNVPuk=\""},{"Name":"Last-Modified","Value":"Mon, 13 Jan 2025 01:25:52 GMT"}],"EndpointProperties":[{"Name":"integrity","Value":"sha256-PBswfbsKasu255N70ciyAZXbp1C+MVfjI3wJ8oNVPuk="}]}]}
\ No newline at end of file
{"ContentRoots":["D:\\Code\\Shop.ERP\\CoreCms.Net.Web.WebApi\\wwwroot\\"],"Root":{"Children":{"favicon.ico":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"favicon.ico"},"Patterns":null},"index.html":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"index.html"},"Patterns":null},"robots.txt":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"robots.txt"},"Patterns":null},"fonts":{"Children":{"SourceHanSansK-Normal.ttf":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"fonts/SourceHanSansK-Normal.ttf"},"Patterns":null}},"Asset":null,"Patterns":null},"static":{"Children":{"images":{"Children":{"logo.png":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"static/images/logo.png"},"Patterns":null}},"Asset":null,"Patterns":null}},"Asset":null,"Patterns":null}},"Asset":null,"Patterns":[{"ContentRootIndex":0,"Pattern":"**","Depth":0}]}}
\ No newline at end of file
FROM mcr.microsoft.com/dotnet/aspnet:5.0
WORKDIR /app
EXPOSE 80
COPY ./ /app
ENV TZ=Asia/Shanghai
RUN sed -i 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1/g' /etc/ssl/openssl.cnf
RUN sed -i 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1/g' /usr/lib/ssl/openssl.cnf
ENTRYPOINT ["dotnet", "CoreCms.Net.Web.WebApi.dll"]
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true" throwExceptions="false" internalLogLevel="Off" internalLogFile="NlogRecords.log">
<!--Nlog内部日志记录为Off关闭。除非纠错,不可以设为Trace否则速度很慢,起码Debug以上-->
<extensions>
<add assembly="NLog.Web.AspNetCore" />
</extensions>
<targets>
<!--通过数据库记录日志 配置
dbProvider请选择mysql或是sqlserver,同时注意连接字符串,需要安装对应的sql数据提供程序
MYSQL:
dbProvider="MySql.Data.MySqlClient.MySqlConnection, MySql.Data"
connectionString="server=localhost;database=BaseMIS;user=root;password=123456"
MSSQL:
dbProvider="Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient"
connectionString="Server=127.0.0.1;Database=BaseMIS;User ID=sa;Password=123456"
-->
<target name="log_database" xsi:type="Database" dbProvider="Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient" connectionString="Server=192.168.8.109;Port=3306;Database=ShopERP;Uid=root;Pwd=123456;CharSet=utf8;pooling=true;SslMode=None;Allow User Variables=true;Convert Zero Datetime=True;Allow Zero Datetime=True;">
<commandText>
INSERT INTO SysNLogRecords
(LogDate,LogLevel,LogType,LogTitle,Logger,Message,MachineName,MachineIp,NetRequestMethod
,NetRequestUrl,NetUserIsauthenticated,NetUserAuthtype,NetUserIdentity,Exception)
VALUES
(@LogDate,@LogLevel,@LogType,@LogTitle,@Logger,@Message,@MachineName,@MachineIp,@NetRequestMethod
,@NetRequestUrl,@NetUserIsauthenticated,@NetUserAuthtype,@NetUserIdentity,@Exception);
</commandText>
<parameter name="@LogDate" layout="${date}" />
<parameter name="@LogLevel" layout="${level}" />
<parameter name="@LogType" layout="${event-properties:item=LogType}" />
<parameter name="@LogTitle" layout="${event-properties:item=LogTitle}" />
<parameter name="@Logger" layout="${logger}" />
<parameter name="@Message" layout="${message}" />
<parameter name="@MachineName" layout="${machinename}" />
<parameter name="@MachineIp" layout="${aspnet-request-ip}" />
<parameter name="@NetRequestMethod" layout="${aspnet-request-method}" />
<parameter name="@NetRequestUrl" layout="${aspnet-request-url}" />
<parameter name="@NetUserIsauthenticated" layout="${aspnet-user-isauthenticated}" />
<parameter name="@NetUserAuthtype" layout="${aspnet-user-authtype}" />
<parameter name="@NetUserIdentity" layout="${aspnet-user-identity}" />
<parameter name="@Exception" layout="${exception:tostring}" />
</target>
<target xsi:type="File" name="log_file" fileName="${basedir}/App_Data/nlog/${date:format=yyyy-MM}/${level}-${shortdate}.csv" encoding="utf-8">
<layout xsi:type="CSVLayout">
<column name="date" layout="${date}" />
<column name="LogTitle" layout="${event-properties:item=LogTitle}" />
<column name="message" layout="${message}" />
<column name="exception" layout="${exception:format=tostring}" />
<column name="machinename" layout="${machinename}" />
<column name="appdomain" layout="${appdomain}" />
<column name="assembly-version" layout=" ${assembly-version}" />
<column name="basedir" layout="${basedir}" />
<column name="callsite" layout="${callsite}" />
<column name="counter" layout="${counter}" />
<column name="nlogdir" layout="${nlogdir}" />
<column name="processid" layout="${processid}" />
<column name="processname" layout="${processname}" />
<column name="specialfolder" layout="${specialfolder}" />
<column name="stacktrace" layout="${stacktrace}" />
<column name="longdate" layout="${longdate}" />
<column name="event-properties" layout="${event-properties:item=EventId_Id}" />
<column name="uppercase" layout="${uppercase:${level}}" />
<column name="logger" layout="${logger}" />
<column name="url" layout="${aspnet-request-url}" />
<column name="action" layout="${aspnet-mvc-action}" />
</layout>
</target>
</targets>
<rules>
<!--跳过所有级别的Microsoft组件的日志记录-->
<logger name="Microsoft.*" final="true" />
<!-- BlackHole without writeTo -->
<!--只通过数据库记录日志,如果给了name名字,cs里用日志记录的时候,取logger需要把name当做参数-->
<logger name="logdb" writeTo="log_database" />
<logger name="logfile" writeTo="log_file" />
</rules>
</nlog>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment