Browse Source

【修改】忘记密码确认按钮逻辑修改;发送短信的类修改;

西昌分支
dyy 4 months ago
parent
commit
0f8f73450f
8 changed files with 36 additions and 334 deletions
  1. +21
    -37
      Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs
  2. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj
  3. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/Default/Index.css
  4. +0
    -250
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/FirstLoginByMobile.cshtml
  5. +2
    -2
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/ForgotPassword.cshtml
  6. +2
    -40
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/ForgotPassword.js
  7. +7
    -1
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/UserApi.cs
  8. +2
    -2
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/UsernologinApi.cs

+ 21
- 37
Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs View File

@@ -45,7 +45,7 @@ namespace Learun.Application.Web.Controllers
WeChatDevelopIBLL weChatDevelopIbll = new WeChatDevelopBLL();
private Sys_DefaultPwdConfigIBLL Sys_DefaultPwdConfigIbll = new Sys_DefaultPwdConfigBLL();
private EmailSendIBLL emailSendIBLL = new EmailSendBLL();
private readonly ISms yixintongSms = new YixintongSms();
private readonly ISms aliyunSms = new AliyunSms();
private ICache redisCache = CacheFactory.CaChe();
#endregion

@@ -1224,14 +1224,6 @@ namespace Learun.Application.Web.Controllers
return View();
}
/// <summary>
/// 首次登录-手机号
/// </summary>
/// <returns></returns>
public ActionResult FirstLoginByMobile()
{
return View();
}
/// <summary>
/// 发送短信验证码
/// </summary>
/// <param name="codeType">发送短信类型:忘记密码forgetpwd,首次登录firstlogin,绑定微信bindwx,解绑微信unbindwx,修改手机号modifymobile,;</param>
@@ -1265,7 +1257,7 @@ namespace Learun.Application.Web.Controllers
var str1 = $"欢迎使用智慧校园,您本次登录的验证码是 " + raRndNum + "。";
listStr.Add(str1);
//todo:待开发短信平台
//var result = yixintongSms.SendSmsToSingle(userEntity.F_Mobile, SmsType.LoginBind, listStr);
//var result = aliyunSms.SendSmsToSingle(userEntity.F_Mobile, SmsType.LoginBind, listStr);
//if (result.Result.code == "0")
if (true)
{
@@ -1299,15 +1291,15 @@ namespace Learun.Application.Web.Controllers
}
}
/// <summary>
/// 短信验证码校验
/// 忘记密码:修改密码
/// </summary>
/// <param name="codeType">发送短信类型</param>
/// <param name="phone">手机号</param>
/// <param name="verifycode">验证码</param>
/// <param name="phone"></param>
/// <param name="newpassword"></param>
/// <returns></returns>
[HttpPost]
public ActionResult LoginCodeVerify(string codeType, string phone, string verifycode)
public ActionResult ForgotPasswordHandle(string codeType, string phone, string verifycode, string newpassword)
{
//短信验证码校验
if (string.IsNullOrEmpty(codeType))
{
return Fail("未指定短信类型。");
@@ -1319,31 +1311,20 @@ namespace Learun.Application.Web.Controllers
var code = redisCache.Read<string>("sendcodeinpc_" + codeType + "_" + phone);
if (!string.IsNullOrEmpty(code) && code == verifycode)
{
return Success("验证成功。");
//return Success("验证成功。");
UserEntity userEntity = userBll.GetEntityByMobile(phone);
if (userEntity == null)
{
return Fail("用户不存在");
}
userBll.setPassword(userEntity.F_UserId, newpassword);

return Success("密码修改成功");
}
else
{
return Fail("验证失败,验证码错误或已失效。");
}

}
/// <summary>
/// 忘记密码:修改密码
/// </summary>
/// <param name="phone"></param>
/// <param name="newpassword"></param>
/// <returns></returns>
[HttpPost]
public ActionResult ForgotPasswordHandle(string phone, string newpassword)
{
UserEntity userEntity = userBll.GetEntityByMobile(phone);
if (userEntity == null)
{
return Fail("用户不存在");
}
userBll.setPassword(userEntity.F_UserId, newpassword);

return Success("密码修改成功");
}
/// <summary>
/// 首次登录:手机号登录
@@ -1378,6 +1359,10 @@ namespace Learun.Application.Web.Controllers
{
return Fail("账户被系统锁定,请联系管理员!");
}
if (userEntity.F_HaveLogMark == true)
{
return Fail("当前用户非首次登录,请使用账号密码进行登录!");
}
userEntity.LoginOk = true;
#region 写入日志
LogEntity logEntity = new LogEntity();
@@ -1423,8 +1408,7 @@ namespace Learun.Application.Web.Controllers
return Fail("验证失败,验证码错误或已失效。");
}
}


#endregion

/// <summary>


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj View File

@@ -4248,6 +4248,7 @@
<Content Include="Views\Login\Default\Index.css" />
<Content Include="Views\Login\Default\Index.js" />
<Content Include="Views\Login\Default\qrcode.min.js" />
<Content Include="Views\Login\ForgotPassword.js" />
<Content Include="Views\Login\images\login1.png" />
<Content Include="Views\Login\images\loginBg.jpg" />
<Content Include="Views\Login\PageFive\IndexWxLogin.js" />
@@ -8126,7 +8127,6 @@
<Content Include="Views\Login\First.cshtml" />
<Content Include="Views\Login\FirstLoginForWeixin.cshtml" />
<Content Include="Views\Home\FirstChangePwd.cshtml" />
<Content Include="Views\Login\FirstLoginByMobile.cshtml" />
<Content Include="Views\Login\ForgotPassword.cshtml" />
</ItemGroup>
<ItemGroup>


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/Default/Index.css View File

@@ -432,7 +432,7 @@ input:disabled {
.lr-login-middle {
position: relative;
width: 100%;
height: 410px;
height: 420px;
background: #fff;
border-radius: 0 0 15px 15px
}


+ 0
- 250
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/FirstLoginByMobile.cshtml View File

@@ -1,250 +0,0 @@
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta name=”renderer” content=”webkit|ie-comp|ie-stand” />
<meta name="viewport" content="width=device-width" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge">

<link rel="icon" href="~/favicon.ico">
<title>数字化校园 - 登录页面</title>
<style>
/* for Chrome */
body::-webkit-scrollbar {
display: none;
}

.lr-login-logo .lr-login-title:before {
background-color: transparent !important
}

.lr-login-footer .OnlineUserNumBox {
float: right;
}

.lr-login-footer > p {
width: 880px;
margin: auto;
}

.tips {
position: absolute;
left: 50%;
bottom: 35px;
color: #fff;
font-size: 13px;
margin-left: -91px;
}

.tips > * {
display: inline-block;
vertical-align: middle;
}

.tips img {
margin-right: 8px
}

.titleImg {
border: none !important;
}

.titleImg img {
width: 35px !important;
}

.wxLogin {
color: #53b947 !important;
}

.titleImg {
color: #da9835 !important;
}

.wxLogin img {
width: 35px !important;
top: -2px;
}

.downBox {
width: 100%;
height: 60px;
/*background: red;*/
position: absolute;
bottom: -40px;
right: 0 color:#fff !important;
}

.downBox a {
color: #fff !important;
border: 1px solid #fff
}
</style>
</head>

<body>
@Html.AppendCssFile("/Views/Login/Default/Index.css")
<link href="~/Content/css/process.css" rel="stylesheet" />
<!-- <img src="~/Content/images/Logins/loginBg.jpg" /> -->
<input id="errornum" type="hidden" value="@ViewBag.errornum" />
<div class="lr-login-body">

<div class="lr-login-logo">
<div class="lr-login-title" style="left: 0%;margin-left: 0;width: 100%;text-align: center;">
<img src="@ViewBag.LoGo" alt="">
</div>
</div>
<div class="lr-login-middle">
@if (ViewBag.WeixinLoginSwitch)
{
<a href="/Login/LoginForWeixin?login=one" class="wxLogin down" title="使用微信登录">
<img src="~/Content/images/LoginPage/icon.png" alt="" /> 使用微信登录
</a>
//首次登录-微信
@*<a href="/Login/FirstLoginForWeixin?login=one" class="down titleImg" title="新生首次登录">
<img src="~/Content/images/LoginPage/title.jpg" alt="" /> 新生首次登录
</a>*@
//首次登录-手机号
<a href="/Login/FirstLoginByMobile" class="down titleImg" title="首次登录">
<img src="~/Content/images/LoginPage/title.jpg" alt="" /> 首次登录
</a>
}
<img src="~/Content/images/logins/login2.png" />
<!--登录框 正常登录-->
<div class="lr-login-main lr-login-normal">
<div class="loginImg" style="display:none;">
<img class="loginImg1" src="~/Content/images/logins/login3.png" alt="">
<img class="loginImg2" src="~/Content/images/logins/login5.png" alt="">
</div>
<!--密码登录-->
<div class="lr-login-bypsw noreg">
<div class="error_info">*&nbsp;<span>密码不正确</span></div>
<div class="lr-login-input">
<img class="inp_icon" src="~/Content/images/Login/default_account0.png" alt=""> <input id="lr_username" type="text" placeholder="学号/工号">
</div>
<div class="lr-login-input">
<img class="inp_icon" src="~/Content/images/Login/default_psw0.png" alt=""><input id="lr_password" type="password" placeholder="密码">
<span id="psw_change"></span>
</div>
<div class="lr-login-input lr-login-reg">
<img class="inp_icon" src="~/Content/images/Login/default_reg0.png" alt=""><input id="lr_verifycode_input" type="text" placeholder="验证码">
<img class="code" id="lr_verifycode_img" src="~/Login/VerifyCode" alt="点击切换验证码" title="点击切换验证码" />
</div>
<div class="lr-login-btn" id="lr_login_btn"><span>登录</span></div>
<br />

<!-- <div class="lr-login-weixin" style="font-size: 12px;margin-top: 15px;text-align: right;padding-right: 71px;"><a href="https://open.weixin.qq.com/connect/qrconnect?appid=wxd75b6651c86f816b&redirect_uri=http%3a%2f%2fwww.learun.cn&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect">微信登录</a></div> -->
<div class="lr-login-version">
<a style="float: left;font-family: PingFangSC-Regular;font-size: 12px;color: #3298DC;margin-right:20px;" href="/Login/ForgotPassword">忘记密码?</a>

@if (ViewBag.TeachSwitch)
{
<a style="float: left;font-family: PingFangSC-Regular;font-size: 12px;color: #3298DC;" href="/EducationalAdministration/EmpInfoEnternal/FormAdd">教师注册</a>
}
@if (ViewBag.Version)
{
<span class="versionBtn" style="cursor:pointer;">版本号:<span>@ViewBag.VersionNum</span></span>
}
</div>
</div>

<div class="loginCode">
<div class="lCodeImg" id="qrcode">
<!-- <img src="~/Content/images/logins/loginCode.jpg" alt=""> -->
</div>
<div class="lCodeTxt"></div>
</div>


</div>
</div>

<div class="downBox">

@if (ViewBag.FeixinSwitch)
{
<a href="/feixin.exe" class="down">
<img src="~/Content/images/LoginPage/download2.jpg" alt="" /> 飞星下载
</a>
}
@if (ViewBag.SSOSystemSwitch)
{
<a href="/SSOSystem/DragModelOne" class="down downsso">
<img src="~/Content/images/LoginPage/wq.jpg" alt="" />
网上办事大厅
</a>
}
</div>
</div>
<div class="lr-login-footer" style="font-size: 12px;color: #fff;width: 880px;right:0;margin: auto;">
<div class="tips">
<img src="~/Content/images/LoginPage/tips3.png" alt=""> <span>建议使用360或谷歌浏览器</span>
</div>
<div style="position: relative;">
Copyright © 2019 数字化智慧校园 版权所有 <span class="OnlineUserNumBox" style="position: absolute;right: 0;top: 0;">在线用户数:<span class="OnlineUserNum">@ViewBag.OnlineUserNum</span>人</span>
</div>

</div>
<img id="loginFoot" src="~/Content/images/logins/login1.png" alt="">
<script src="~/Content/jquery/jquery-1.10.2.min.js"></script>
<script src="~/Content/jquery/jquery.md5.min.js"></script>
<script src="~/Content/jquery/qrcode.min.js"></script>
<script src="~/Content/jquery/plugin/layer/layer.js"></script>
<script>
function request(d) { for (var c = location.search.slice(1).split("&"), a = 0; a < c.length; a++) { var b = c[a].split("="); if (b[0] == d) if ("undefined" == unescape(b[1])) break; else return unescape(b[1]) } return "" };
$.rootUrl = '@Url.Content("~")'.substr(0, '@Url.Content("~")'.length - 1);
$.lrToken = $('@Html.AntiForgeryToken()').val();
var DigitalschoolMisLoginurl = "@ViewBag.DigitalschoolMisLoginurl";
var Returnurl = "@ViewBag.Returnurl";
var Ip = "@ViewBag.Ip";
var ACIp = "@ViewBag.ACIp";
var ACIp2 = "@ViewBag.ACIp2";
//判断是否有登录二维码:有,显示扫码登录;否,不显示;
if ("@ViewBag.HasQRCode" == "True") {
$('.loginImg').show();
$('.lCodeTxt').html("@ViewBag.Title");
} else {
$('.loginImg').hide();
}

//密码登录与扫码登录切换
$('.loginImg').click(function(){
var that = $(this); if(that.hasClass('active')){

that.removeClass('active');
$('.loginCode').css({display:'none'}).siblings('.noreg').stop().fadeIn();
}else{
that.addClass('active');
$('.noreg').css({display:'none'}).siblings('.loginCode').stop().fadeIn();
}
})
var qrcode = new QRCode(document.getElementById("qrcode"), {
width : 200,
height : 200
});
qrcode.makeCode("@ViewBag.QRCodeUrl");
</script>
@Html.AppendJsFile("/Views/Login/Default/Index.js")
@Html.AppendJsFile("/Views/Login/ACLogon.js")

<script>
//点击版本号,显示版本号历史进程
$('.versionBtn').click(function () {
var html = '<div class="process"><div class="proTitle">历史进程</div><div class="pro_sec1">';
$.each(@(new HtmlString(ViewBag.VersionList)), function (i, item) {
var index = i % 2 == 0 ? 1 : 2;
html += '<div class="proBox proBox'+index+'">' + item.Content + '<div class="edition">' + item.VersionNum + '</div><div class="time">' + item.UpdateTime.slice(0,item.UpdateTime.indexOf("T"))+'</div></div>' ;
});
html += '</div></div>';

layer.open({
type: 1,
closeBtn: 2,
title: "版本号",
area: ['888px', '60%'],
content: html
})
});
</script>
</body>
</html>

+ 2
- 2
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/ForgotPassword.cshtml View File

@@ -134,8 +134,8 @@
<div class="lr-login-btn" id="confirmUpdate"><span>确认</span></div>
</div>
</div>
<a href="Javascript:void(0)" id="goLogin" class="down titleImg" title="去登">
<img src="~/Content/images/LoginPage/title.jpg" alt="" /> <span>去登</span>
<a href="Javascript:void(0)" id="goLogin" class="down titleImg" title="去登">
<img src="~/Content/images/LoginPage/title.jpg" alt="" /> <span>去登</span>
</a>
</div>
</div>


+ 2
- 40
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/ForgotPassword.js View File

@@ -109,39 +109,6 @@
}
});
},
checkverifycode: function () {
return new Promise((resolve) => {
let verifycode = $('#verifycode').val()
let phone = $('#phone').val()
if (!verifycode) {
$('#updatepwBox .error_info span').text('请输入验证码')
$('#updatepwBox .error_info').show()
resolve(false)
return
}
$('#updatepwBox .error_info').hide()
$.ajax({
url: "/Login/LoginCodeVerify",
data: { phone, verifycode, codeType },
dataType: 'json',
type: "post",
success: (res) => {
if (res.code == 200) {
resolve(true)
} else {
$('#updatepwBox .error_info span').text(res.info)
$('#updatepwBox .error_info').show()
resolve(false)
}
},
error: () => {
$('#updatepwBox .error_info span').text('验证码校验失败')
$('#updatepwBox .error_info').show()
resolve(false)
}
});
})
},
confirmUpdate: async function () {
let phone = $('#phone').val()
let verifycode = $('#verifycode').val()
@@ -185,14 +152,9 @@
}
$('#updatepwBox .error_info').hide()
lrPage.updating(true);
let codeRes = await lrPage.checkverifycode()
if (!codeRes) {
lrPage.updating(false);
return
}
$.ajax({
url: "/Login/ForgotPasswordHandle",
data: { phone, codeType, newpassword },
data: { phone, verifycode, codeType, newpassword: $.md5(newpassword) },
dataType: 'json',
type: "post",
success: (res) => {
@@ -201,7 +163,7 @@
$('#updatepwBox .error_info').show()
setTimeout(() => {
window.location.href = "/";
},1500)
}, 1500)
} else {
lrPage.updating(false);
$('#updatepwBox .error_info span').text(res.info)


+ 7
- 1
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/UserApi.cs View File

@@ -6,6 +6,7 @@ using Learun.Cache.Factory;
using Learun.Util;
using Learun.Util.Operat;
using Nancy;
using Quanjiang.DigitalScholl.SendSms;
using System;
using System.Collections.Generic;
using System.Configuration;
@@ -50,6 +51,7 @@ namespace Learun.Application.WebApi
private RoleIBLL roleIBLL = new RoleBLL();
private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL();
CdMajorIBLL majorIbll = new CdMajorBLL();
private readonly ISms aliyunSms = new AliyunSms();
private ICache redisCache = CacheFactory.CaChe();


@@ -118,7 +120,7 @@ namespace Learun.Application.WebApi
var str1 = $"欢迎使用智慧校园,您本次登录的验证码是 " + raRndNum + "。";
listStr.Add(str1);
//todo:待开发短信平台
//var result = yixintongSms.SendSmsToSingle(loginModel.username, SmsType.LoginBind, listStr);
//var result = aliyunSms.SendSmsToSingle(loginModel.username, SmsType.LoginBind, listStr);
//if (result.Result.code == "0")
if (true)
{
@@ -344,6 +346,10 @@ namespace Learun.Application.WebApi
{
return Fail("账户被系统锁定,请联系管理员!");
}
if (userEntity.F_HaveLogMark == true)
{
return Fail("当前用户非首次登录,请使用账号密码进行登录!");
}
userEntity.LoginOk = true;

#region 写入日志


+ 2
- 2
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/UsernologinApi.cs View File

@@ -41,7 +41,7 @@ namespace Learun.Application.WebApi
private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL();
private EmpInfoIBLL empInfoIBLL = new EmpInfoBLL();
CdMajorIBLL majorIbll = new CdMajorBLL();
private readonly ISms yixintongSms = new YixintongSms();
private readonly ISms aliyunSms = new AliyunSms();
private ICache redisCache = CacheFactory.CaChe();
private Sys_UpdateRecordIBLL sysUpdateRecordIbll = new Sys_UpdateRecordBLL();
AnnexesFileIBLL annexesFileIbll = new AnnexesFileBLL();
@@ -115,7 +115,7 @@ namespace Learun.Application.WebApi
var str1 = $"欢迎使用智慧校园,您本次登录的验证码是 " + raRndNum + "。";
listStr.Add(str1);
//todo:待开发短信平台
//var result = yixintongSms.SendSmsToSingle(userEntity.F_Mobile, SmsType.LoginBind, listStr);
//var result = aliyunSms.SendSmsToSingle(userEntity.F_Mobile, SmsType.LoginBind, listStr);
//if (result.Result.code == "0")
if (true)
{


Loading…
Cancel
Save