diff --git a/OpenAuth.App/SSO/PassportLoginRequest.cs b/OpenAuth.App/SSO/PassportLoginRequest.cs index c5c20d0d..f2526f84 100644 --- a/OpenAuth.App/SSO/PassportLoginRequest.cs +++ b/OpenAuth.App/SSO/PassportLoginRequest.cs @@ -1,4 +1,6 @@ -namespace OpenAuth.App.SSO +using System; + +namespace OpenAuth.App.SSO { public class PassportLoginRequest @@ -11,6 +13,15 @@ public void Trim() { + if (string.IsNullOrEmpty(UserName)) + { + throw new Exception("用户名不能为空"); + } + + if (string.IsNullOrEmpty(Password)) + { + throw new Exception("密码不能为空"); + } UserName = UserName.Trim(); Password = Password.Trim(); if(!string.IsNullOrEmpty(AppKey)) AppKey = AppKey.Trim(); diff --git a/OpenAuth.App/SSO/SSOAuthUtil.cs b/OpenAuth.App/SSO/SSOAuthUtil.cs index defba8c6..242a5edd 100644 --- a/OpenAuth.App/SSO/SSOAuthUtil.cs +++ b/OpenAuth.App/SSO/SSOAuthUtil.cs @@ -13,12 +13,10 @@ namespace OpenAuth.App.SSO { public static LoginResult Parse(PassportLoginRequest model) { - model.Trim(); - var result = new LoginResult(); - try { + model.Trim(); //ȡӦϢ var appInfo = new AppInfoService().Get(model.AppKey); if (appInfo == null) diff --git a/OpenAuth.Mvc/Views/Login/Index.cshtml b/OpenAuth.Mvc/Views/Login/Index.cshtml index 3bbf6a52..2dc2e65a 100644 --- a/OpenAuth.Mvc/Views/Login/Index.cshtml +++ b/OpenAuth.Mvc/Views/Login/Index.cshtml @@ -57,13 +57,13 @@