手机端API接口测试优化,支持验证码登录。

This commit is contained in:
thinkgem
2018-03-21 20:37:50 +08:00
parent fdd73a7442
commit 25c306e689
3 changed files with 11 additions and 3 deletions

View File

@@ -86,6 +86,10 @@ public class LoginController extends BaseController{
// 是否显示验证码 // 是否显示验证码
model.addAttribute("isValidCodeLogin", ObjectUtils.toInteger(Global.getConfig("sys.login.failedNumAfterValidCode", "200")) == 0); model.addAttribute("isValidCodeLogin", ObjectUtils.toInteger(Global.getConfig("sys.login.failedNumAfterValidCode", "200")) == 0);
//获取当前会话对象
Session session = UserUtils.getSession();
model.addAttribute("sessionid", (String)session.getId());
// 获取登录参数 // 获取登录参数
Map<String, Object> paramMap = ServletUtils.getExtParams(request); Map<String, Object> paramMap = ServletUtils.getExtParams(request);
@@ -173,6 +177,10 @@ public class LoginController extends BaseController{
model.addAttribute("isValidCodeLogin", BaseAuthorizingRealm.isValidCodeLogin(username, /*corpCode, */(String)paramMap.get("deviceType"), "failed")); model.addAttribute("isValidCodeLogin", BaseAuthorizingRealm.isValidCodeLogin(username, /*corpCode, */(String)paramMap.get("deviceType"), "failed"));
} }
//获取当前会话对象
Session session = UserUtils.getSession();
model.addAttribute("sessionid", (String)session.getId());
// 登录操作如果是Ajax操作直接返回登录信息字符串。 // 登录操作如果是Ajax操作直接返回登录信息字符串。
if (ServletUtils.isAjaxRequest(request)){ if (ServletUtils.isAjaxRequest(request)){
model.addAttribute("result", Global.FALSE); model.addAttribute("result", Global.FALSE);

View File

@@ -262,7 +262,7 @@ shiro:
isAllowExternalSiteIframe: true isAllowExternalSiteIframe: true
# 是否允许跨域访问,如果允许,设置允许的域名,全部域名设置*号,如果不允许,此设置应该为空 # 是否允许跨域访问,如果允许,设置允许的域名,全部域名设置*号,如果不允许,此设置应该为空
# accessControlAllowOrigin: http://demo.jeesite.com # accessControlAllowOrigin: http://demo.jeesite.net
# accessControlAllowOrigin: '*' # accessControlAllowOrigin: '*'
# URI 权限过滤器定义 # URI 权限过滤器定义

View File

@@ -43,9 +43,9 @@ public class MobileAppTest {
* 登录地址及登录信息 * 登录地址及登录信息
*/ */
private static String loginUrl = "/login" private static String loginUrl = "/login"
+ "?username=" + DesUtils.encode("thinkgem", "thinkgem,jeesite,com") + "?username=" + DesUtils.encode("system", "thinkgem,jeesite,com")
+ "&password=" + DesUtils.encode("admin", "thinkgem,jeesite,com") + "&password=" + DesUtils.encode("admin", "thinkgem,jeesite,com")
+ "&param_deviceType=mobileApp"; + "&param_deviceType=mobileApp&__sid=";
/** /**
* 存储的会话编号则通过getSid()获取。 * 存储的会话编号则通过getSid()获取。