Sfoglia il codice sorgente

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

西昌分支
dyy 4 mesi fa
parent
commit
0c0f294bf7
5 ha cambiato i file con 31 aggiunte e 0 eliminazioni
  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 Vedi File

@@ -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 Vedi File

@@ -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 Vedi File

@@ -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 Vedi File

@@ -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 Vedi File

@@ -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
}
}

Caricamento…
Annulla
Salva