瀏覽代碼

【修改】发短信接口:增加手机号格式的验证;

西昌分支
dyy 4 月之前
父節點
當前提交
0c0f294bf7
共有 5 個檔案被更改,包括 31 行新增0 行删除
  1. +4
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/HomeController.cs
  2. +4
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs
  3. +4
    -0
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/UserApi.cs
  4. +4
    -0
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/UsernologinApi.cs
  5. +15
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Common/CommonHelper.cs

+ 4
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/HomeController.cs 查看文件

@@ -760,6 +760,10 @@ namespace Learun.Application.Web.Controllers
{
return Fail("用户手机号不存在!");
}
if (!CommonHelper.IsValidMobile(userEntity.F_Mobile))
{
return Fail("手机号格式不正确!");
}
//todo:待取消注释
//string raRndNum = Learun.Util.CommonHelper.RndNum(6);
string raRndNum = "123456";


+ 4
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs 查看文件

@@ -1246,6 +1246,10 @@ namespace Learun.Application.Web.Controllers
{
return Fail("用户手机号不存在!");
}
if (!CommonHelper.IsValidMobile(userEntity.F_Mobile))
{
return Fail("手机号格式不正确!");
}
if (codeType == "firstlogin" && userEntity.F_HaveLogMark == true)
{
return Fail("当前用户非首次登录,请使用账号密码进行登录!");


+ 4
- 0
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/UserApi.cs 查看文件

@@ -113,6 +113,10 @@ namespace Learun.Application.WebApi
{
return Fail("手机号不能为空。");
}
if (!CommonHelper.IsValidMobile(loginModel.username))
{
return Fail("手机号格式不正确!");
}
//todo:待取消注释
//string raRndNum = Learun.Util.CommonHelper.RndNum(6);
string raRndNum = "123456";


+ 4
- 0
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/UsernologinApi.cs 查看文件

@@ -104,6 +104,10 @@ namespace Learun.Application.WebApi
{
return Fail("用户手机号不存在!");
}
if (!CommonHelper.IsValidMobile(userEntity.F_Mobile))
{
return Fail("手机号格式不正确!");
}
if (loginModel.codeType == "firstlogin" && userEntity.F_HaveLogMark == true)
{
return Fail("当前用户非首次登录,请使用账号密码进行登录!");


+ 15
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Common/CommonHelper.cs 查看文件

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;

namespace Learun.Util
{
@@ -145,5 +146,19 @@ namespace Learun.Util
return str;
}
#endregion

#region 验证字符串的格式

/// <summary>
/// 是否是手机格式
/// </summary>
/// <param name="mobile"></param>
/// <returns></returns>
public static bool IsValidMobile(string mobile)
{
return Regex.IsMatch(mobile, @"^(\+\d{2,3}\-)?\d{11}$");
}

#endregion
}
}

Loading…
取消
儲存