<%@ page language="java" contentType="text/html; charset=UTF-8"
|
pageEncoding="UTF-8"%>
|
<%@page import="com.yc.sdk.shopping.util.SettingKey"%>
|
<%@page import="com.yc.utils.SessionKey"%>
|
<%
|
|
String hostUrl = SettingKey.getHostUrl(request) ;
|
String wxQueryString = SettingKey.getQueryStringByWx(request);
|
boolean isMoblieBrowser = SettingKey.isMoblieBrowser(request);
|
String oauth2UUID = request.getParameter(SessionKey.OAUTH2UUID) ;
|
if (oauth2UUID == null || "".equals(oauth2UUID)) {
|
out.println( "非法访问!");
|
return ;
|
}
|
|
//String openId = request.getParameter("openid") ;
|
String dbid = request.getParameter(SessionKey.DATA_BASE_ID ) ;
|
String redirect = request.getParameter("redirect"); // 登录后重定向页面,Added by Johns Wang, 2016-02-17
|
String orgHost = request.getParameter("orghost") ; //原始主机名
|
String oauth2from = request.getParameter("oauth2from") ;
|
%>
|
<!DOCTYPE html >
|
<html>
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<script src="<%=hostUrl%>/shopping/view/javascript/jquery/jquery-2.1.1.min.js?v=<%=com.yc.utils.FileUtil.getVerstion(request,"/shopping/view/javascript/jquery/jquery-2.1.1.min.js")%>" type="text/javascript"></script>
|
<link href="<%=hostUrl%>/shopping/view/javascript/bootstrap/css/bootstrap.min.css?v=<%=com.yc.utils.FileUtil.getVerstion(request,"/shopping/view/javascript/bootstrap/css/bootstrap.min.css")%>" rel="stylesheet" media="screen" />
|
<script src="<%=hostUrl%>/shopping/view/javascript/bootstrap/js/bootstrap.min.js?v=<%=com.yc.utils.FileUtil.getVerstion(request,"/shopping/view/javascript/bootstrap/js/bootstrap.min.js")%>" type="text/javascript"></script>
|
<link href="<%=hostUrl%>/shopping/view/javascript/font-awesome/css/font-awesome.min.css?v=<%=com.yc.utils.FileUtil.getVerstion(request,"/shopping/view/javascript/font-awesome/css/font-awesome.min.css")%>" rel="stylesheet" type="text/css" />
|
|
<link href="<%=hostUrl%>/shopping/view/theme/default/stylesheet/googleapisFont.css?v=<%=com.yc.utils.FileUtil.getVerstion(request,"/shopping/view/theme/default/stylesheet/googleapisFont.css")%>" rel="stylesheet" type="text/css" />
|
<link href="<%=hostUrl%>/shopping/view/theme/default/stylesheet/stylesheet.css?v=<%=com.yc.utils.FileUtil.getVerstion(request,"/shopping/view/theme/default/stylesheet/stylesheet.css")%>" rel="stylesheet">
|
|
<title>绑定登录用户</title>
|
</head>
|
<body>
|
<div class="container">
|
<div class="" id="collapse-messages"><div class="panel-body"></div></div>
|
<div class="row">
|
<div id="content" class="col-sm-12">
|
<h1>您第一次使用<%= oauth2from!=null&&oauth2from.equals("wx")?"微信":"" %><%= oauth2from!=null&&oauth2from.equals("qq")?"QQ":"" %>扫码登录,需要绑定登录用户(请在20分钟内完成)</h1>
|
<form action="<%=hostUrl %>/oauth2/buildinguser.do?<%= SessionKey.OAUTH2UUID %>=<%=oauth2UUID %><%= (wxQueryString == null||"".equals(wxQueryString)?"":"&" + wxQueryString) %>" method="post" class="form-horizontal">
|
<fieldset>
|
<div class="form-group required">
|
<label class="col-sm-2 control-label" for="topic">账号:</label>
|
<div class="col-sm-10">
|
<input type="text" name="account" value="" placeholder="账号" id="input-account" class="form-control" />
|
</div>
|
</div>
|
<div class="form-group required">
|
<label class="col-sm-2 control-label" for="pwd">密码:</label>
|
<div class="col-sm-10">
|
<input type="password" name="pwd" value="" placeholder="密码" id="input-pwd" class="form-control" />
|
</div>
|
</div>
|
|
</fieldset>
|
<div class="buttons clearfix">
|
<input type="hidden" name="redirect" value="<%= redirect==null?"":redirect %>"/>
|
<input type="hidden" name="orghost" value="<%= orgHost==null?"":orgHost %>"/>
|
<input type="hidden" name="<%= SessionKey.DATA_BASE_ID %>" value="<%= dbid==null?"":dbid %>"/>
|
<div class="pull-right">
|
<input type="button" value="提交" id="button-submit" class="btn btn-primary" />
|
</div>
|
</div>
|
|
</form>
|
</div>
|
</div>
|
</div>
|
|
|
<script type="text/javascript"><!--
|
$('#button-submit').on('click', function() {
|
//var mydate = $('#input-unvaliddate').val() ;
|
//var aa = moment(mydate).format('YYYY-MM-DD hh:mm');
|
$.ajax({
|
url: '<%=hostUrl %>/oauth2/buildinguser.do?<%= SessionKey.OAUTH2UUID %>=<%=oauth2UUID %><%= (wxQueryString == null||"".equals(wxQueryString)?"":"&" + wxQueryString) %>',
|
type: 'post',
|
data: $('input[type=\'text\'],input[type=\'radio\']:checked,input[type=\'checkbox\']:checked,select,textarea,input[type=\'password\'],input[type=\'hidden\']'),
|
dataType: 'json',
|
beforeSend: function() {
|
$('#button-submit').button('loading');
|
},
|
complete: function() {
|
$('#button-submit').button('reset');
|
},
|
success: function(json) {
|
$('.alert, .text-danger').remove();
|
if (json['success']) {
|
alert(json['success']) ;
|
}
|
var messagetxt = "" ;
|
for (i in json["warning"]) {
|
if (json["warning"][i]["messagetxt"]) {
|
messagetxt += json["warning"][i]["messagetxt"] + "\n\r" ;
|
}
|
}
|
if (messagetxt != "") {
|
$('#collapse-messages .panel-body').prepend('<div class="alert alert-warning">' + messagetxt + '<button type="button" class="close" data-dismiss="alert">×</button></div>');
|
}
|
|
|
if (json['redirect'] && messagetxt == "") {
|
location = json['redirect'];
|
} else if (json['error']) {
|
|
|
|
if (json['error']['warning']) {
|
$('#collapse-messages .panel-body').prepend('<div class="alert alert-warning">' + json['error']['warning'] + '<button type="button" class="close" data-dismiss="alert">×</button></div>');
|
}
|
|
for (i in json['error']) {
|
var element = $('#input-' + i.replace('_', '-'));
|
|
if ($(element).parent().hasClass('input-group')) {
|
$(element).parent().after('<div class="text-danger">' + json['error'][i] + '</div>');
|
} else {
|
$(element).after('<div class="text-danger">' + json['error'][i] + '</div>');
|
}
|
}
|
|
// Highlight any found errors
|
$('.text-danger').parent().parent().addClass('has-error');
|
}
|
},
|
error: function(xhr, ajaxOptions, thrownError) {
|
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
}
|
});
|
});
|
//--></script>
|
</body>
|
</html>
|