master
huanghai 5 years ago
parent 537941e6bb
commit b992a6fb90

@ -24,7 +24,8 @@ require (
github.com/klauspost/compress v1.10.9 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/lunny/log v0.0.0-20160921050905-7887c61bf0de // indirect
github.com/olivere/elastic/v7 v7.0.17
github.com/mailru/easyjson v0.7.2 // indirect
github.com/olivere/elastic/v7 v7.0.19
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
github.com/pkg/sftp v1.11.0
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect

@ -37,6 +37,7 @@ github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu
github.com/atotto/clipboard v0.1.2 h1:YZCtFu5Ie8qX2VmVTBnrqLSiU9XOWwqNRmdT3gIQzbY=
github.com/atotto/clipboard v0.1.2/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
github.com/aws/aws-sdk-go v1.31.12/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go v1.33.5/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/bluesky335/IDCheck v0.0.0-20200319021444-08ee85bfcb7b h1:qJpZ1/QxjgYzxvCo2ylIBfgzm6X34pfquB6Qe9dr1+Y=
github.com/bluesky335/IDCheck v0.0.0-20200319021444-08ee85bfcb7b/go.mod h1:PD4Jsv8cyK6DDv/UlGpnr4qmIq1+2ii5xSGgBfO1Sho=
github.com/bndr/gotabulate v1.1.2 h1:yC9izuZEphojb9r+KYL4W9IJKO/ceIO8HDwxMA24U4c=
@ -148,6 +149,7 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 h1:l5lAOZEym3oK3SQ2HBHWsJUfbNBiTXJDeW2QDxw9AQ0=
@ -162,6 +164,8 @@ github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0/go.mod h1:N0
github.com/jcmturner/gofork v1.0.0 h1:J7uCkflzTEhUZ64xqKnkDxq3kzc96ajM1Gli5ktUem8=
github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o=
github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
@ -200,6 +204,8 @@ github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.7.1 h1:mdxE1MF9o53iCb2Ghj1VfWvh7ZOwHpnVG/xwXrV90U8=
github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=
github.com/mailru/easyjson v0.7.2 h1:V9ecaZWDYm7v9uJ15RZD6DajMu5sE0hdep0aoDwT9g4=
github.com/mailru/easyjson v0.7.2/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
@ -218,10 +224,13 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA
github.com/olivere/elastic v6.2.33+incompatible h1:SRPB2w2OhJ7iULftDEHsNPRoL2GLREqPMRalVmbZaEw=
github.com/olivere/elastic/v7 v7.0.17 h1:VMHAc164MH85MIOyyyL6AAzIDixsdjIdAfmKotxNxyQ=
github.com/olivere/elastic/v7 v7.0.17/go.mod h1:sd6x2HP229aT2+U2261gUUMCD4RVf/Nsso8HxSgcjDs=
github.com/olivere/elastic/v7 v7.0.19 h1:w4F6JpqOISadhYf/n0NR1cNj73xHqh4pzPwD1Gkidts=
github.com/olivere/elastic/v7 v7.0.19/go.mod h1:4Jqt5xvjqpjCqgnTcHwl3j8TLs8mvoOK8NYgo/qEOu4=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/pierrec/lz4 v2.4.1+incompatible h1:mFe7ttWaflA46Mhqh+jUfjp2qTbPYxLB2/OyBppH9dg=
github.com/pierrec/lz4 v2.4.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pierrec/lz4 v2.5.2+incompatible h1:WCjObylUIOlKy/+7Abdn34TLIkXiA4UWUMhxq9m9ZXI=
@ -249,6 +258,7 @@ github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykE
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/assertions v1.1.0 h1:MkTeG1DMwsrdH7QtLXy5W+fUxWq+vmb6cLmyJ7aRtF0=
github.com/smartystreets/assertions v1.1.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
github.com/smartystreets/assertions v1.1.1/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
@ -311,6 +321,7 @@ github.com/xuri/efp v0.0.0-20191019043341-b7dc4fe9aa91 h1:gp02YctZuIPTk0t7qI+wvg
github.com/xuri/efp v0.0.0-20191019043341-b7dc4fe9aa91/go.mod h1:uBiSUepVYMhGTfDeBKKasV4GpgBlzJ46gXUBAqV8qLk=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=

@ -21,6 +21,7 @@ import (
"fmt"
"github.com/dchest/captcha"
"github.com/gin-gonic/gin"
"github.com/tidwall/gjson"
"io/ioutil"
"net/http"
"strconv"
@ -45,6 +46,8 @@ func Routers(r *gin.RouterGroup) {
r.GET("/logout", logout)
//清空登录限制
r.GET("/resetRemainCount", resetRemainCount)
//微信登录
r.GET("/wxLogin", wxLogin)
return
}
@ -480,3 +483,38 @@ func resetRemainCount(context *gin.Context) {
context.JSON(http.StatusOK, map[string]interface{}{"success": true, "msg": msg})
return
}
// @Summary 微信登录
// @Description 微信登录
// @Tags 登录验证类
// @Accept application/x-www-form-urlencoded
// @Produce json
// @Param code query string true "腾讯返回的code码"
// @Success 200 {string} string
// @Router /oauth2/wxLogin [get]
// @X-EmptyLimit ["code"]
// http://10.10.14.187/oauth2/wxLogin?code=??
func wxLogin(context *gin.Context) {
var code = context.Query("code")
//对接微信腾讯给的AK+SK
appId := "wx3e0449144386938a"
appSecret := "15a37979f34791ca8b920c386afaa0d5"
//验证的地址
var accessTokenUrl = "https://api.weixin.qq.com/sns/oauth2/access_token"
var accessTokenParams = fmt.Sprintf("appid=%s&secret=%s&code=%s&grant_type=authorization_code", appId, appSecret, code)
//http调用
resp, err := http.Get(accessTokenUrl + "?" + accessTokenParams)
if err != nil {
fmt.Println(err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if resp.StatusCode == 200 {
//将返回结果转为json
openid := gjson.Get(string(body), "openid")
context.JSON(http.StatusOK, map[string]interface{}{"success": true, "openid": openid})
} else {
context.JSON(http.StatusOK, map[string]interface{}{"success": false, "openid": ""})
}
}

@ -44,6 +44,8 @@ require (
github.com/swaggo/swag v1.6.5
github.com/syndtr/goleveldb v1.0.0 // indirect
github.com/tealeg/xlsx v1.0.5 // indirect
github.com/tidwall/gjson v1.6.0 // indirect
github.com/tidwall/pretty v1.0.1 // indirect
github.com/tracer0tong/kafkalogrus v0.0.0-20180816014403-290bb4d4d549
github.com/xormplus/builder v0.0.0-20200331055651-240ff40009be // indirect
github.com/xormplus/core v0.0.0-20200308074340-f3bce19d5f31

@ -316,6 +316,14 @@ github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpP
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
github.com/tealeg/xlsx v1.0.5 h1:+f8oFmvY8Gw1iUXzPk+kz+4GpbDZPK1FhPiQRd+ypgE=
github.com/tealeg/xlsx v1.0.5/go.mod h1:btRS8dz54TDnvKNosuAqxrM1QgN1udgk9O34bDCnORM=
github.com/tidwall/gjson v1.6.0 h1:9VEQWz6LLMUsUl6PueE49ir4Ka6CzLymOAZDxpFsTDc=
github.com/tidwall/gjson v1.6.0/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls=
github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc=
github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tidwall/pretty v1.0.1 h1:WE4RBSZ1x6McVVC8S/Md+Qse8YUv6HRObAx6ke00NY8=
github.com/tidwall/pretty v1.0.1/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tracer0tong/kafkalogrus v0.0.0-20180816014403-290bb4d4d549 h1:hqEVIPHSz/NB7wobGhaNjx7qelBUMM9Xw/20mjDxvp4=
github.com/tracer0tong/kafkalogrus v0.0.0-20180816014403-290bb4d4d549/go.mod h1:llNPwZUpuR/gPA17kqlHPTWK9ohsBjijSwR0Kprsbbc=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=

@ -1,241 +1,240 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>长春市教育管理公共服务平台统一认证中心</title>
<link rel="stylesheet" type="text/css" href="./css/style.css"/>
<script type="text/javascript" src="./js/jquery-1.12.4.min.js"></script>
<script src="./js/jsencrypt.min.js" type="text/javascript"></script>
</head>
<body>
<div id="header">
<img src="./images/edusoa.png" style="margin-left: 30px;margin-top: 8px;"/><span
style="font-size:36px;display: block;margin-left: 233px;margin-top: -58px;font-weight:bold"
id="system_name">长春市教育管理公共服务平台统一认证中心</span>
</div>
<div class="login-wrap">
<div class="wrap clearfix">
<img src="./images/login-img.png" style="margin-top: 22px;"/>
<div class="form-box fr loginV2" style="display: block;">
<ul class="form-tab clearfix">
<li class="tab-li cur">
<a href="javascript:;" tjjj="passport.login_type.login_name">账户登录</a></li>
</ul>
<div class="form-con">
<div class="login-normal" style="display: block;">
<form id="nameLoginForm">
<div class="form-error" style="">
<i>
</i>
<label class="text"></label>
</div>
<dl class="clearfix">
<dt><em></em>户:</dt>
<dd>
<input type="text" name="loginName" id="usernameTxt" value="sys1" class="input-text"
autocomplete="off" placeholder="账户名/邮箱/手机号"/></dd>
</dl>
<dl class="top1 clearfix">
<dt><em></em>码:</dt>
<dd>
<input type="password" name="password" id="passwordTxt" value="123456"
class="input-text" placeholder="请输入密码"></dd>
</dl>
<dl class="top2 clearfix">
<dt>验证码:</dt>
<dd>
<input name="smsCaptcha" type="text" id="captchaTxt" class="input-yzm" maxlength="6"
autocomplete="off"/>
<span class="span-yzm">
<img id="userCaptchaImage" title="点击图片刷新校验码" alt="点击图片刷新校验码" style="cursor:pointer"
onclick="javascript:refreshCaptcha()"/>
<a onclick="javascript:refreshCaptcha()" class="forget-pass" style="cursor:pointer">换一张</a></span>
</dd>
</dl>
<div class="btn-box clearfix" style="margin-top: 10px;">
<input id="loginBtn" class="btn-settlement" type="button" value="登 录"
tjjj="passport.button.login"></div>
<input type="hidden" name="captchaId" id="captchaId" value="">
<input type="hidden" name="redirect_uri" id="redirect_uri" value="">
<input type="hidden" name="client_id" id="client_id" value="">
<input type="hidden" name="response_type" id="response_type" value="">
<input type="hidden" name="oauth_callback" id="oauth_callback" value="">
<div class="link-box clearfix">
<a href="javascript:;" id="findPwd" class="forget-pass" tjjj="passport.forget.password">忘记密码?</a>
</div>
</form>
<div class="login-short clearfix">
<div class="short-left">
<h3>第三方账号登录:</h3>
<ul class="clearfix">
<li class="qq">
<!--<a a href="https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=101470748&scope=all&redirect_uri=https://10.10.14.200/dsssoserver/html/jumpQq.html" tjjj="passport.login.thd.login.qq"></a>-->
<a a href="#" tjjj="passport.login.thd.login.qq"></a>
</li>
<li class="weixin">
<!--<a href="https://open.weixin.qq.com/connect/qrconnect?appid=wx3e0449144386938a&redirect_uri=https://10.10.14.200/dsssoserver/html/jumpWx.html&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect" tjjj="passport.login.thd.login.weixin"></a>-->
<a href="#" tjjj="passport.login.thd.login.weixin"></a>
</li>
</ul>
</div>
<div class="short-right">
<h3>您还可以选择:</h3>
<p class="phone-short clearfix">
<i class="phone"></i>
<!--<a href="javascript:;" tjjj="" class="txt phoneLogin">手机快捷登录</a>-->
<a href="#" tjjj="" class="txt phoneLogin">手机快捷登录</a>
</p>
</div>
</div>
</div>
</div>
</div>
<!-- -快捷登录 -->
<div class="form-box fr shortLogin" style="display: none;">
<ul class="form-tab clearfix">
<li class="tab-li cur">
<a href="javascript:;" tjjj="passport.login_type.login_name">手机快捷登录</a></li>
</ul>
<div class="form-con">
<form id="mobileLoginForm">
<div class="form-error" style="">
<i>
</i>
<label class="text"></label>
</div>
<dl class="clearfix">
<dt>手机号:</dt>
<dd>
<input type="text" id="phoneTxt" autocomplete="off" class="input-text mobile" maxlength="11"
placeholder="请输入手机号"/>
</dd>
</dl>
<!--
<dl class="top1 clearfix">
<dt>验证码:</dt>
<dd>
<input name="smsCaptcha" type="text" id="partnerYzm" class="input-yzm" onblur="captchCheck(this);" maxlength="4" autocomplete="off" />
<span class="span-yzm">
<img id="smsCaptchaImage" title="点击图片刷新校验码" alt="点击图片刷新校验码" onclick="changeCode('smsCaptchaImage','partnerYzm');" />
<a href="javascript:changeCode('smsCaptchaImage','partnerYzm');" class="forget-pass">换一张</a></span>
</dd>
</dl>
-->
<dl class="top1 clearfix">
<dt>动态码:</dt>
<dd>
<input name="code" type="text" id="smsCode" class="input-jym" maxlength="6"
autocomplete="off" placeholder="请输入动态码"/>
<a id="smsSendButton" onclick="sendSms();" class="span-jym" style="cursor:pointer"
tjjj="passport.send.msg">发送动态码</a></dd>
</dl>
<div class="btn-box clearfix" style="margin-top: 35px;">
<input id="smsFlagHidden" type="hidden"/>
<input id="smsLoginBtn" class="btn-settlement" type="button" value="登 录"
tjjj="passport.quick.button.login"></div>
<div class="link-box clearfix" style="margin-top: 30px;">
<a href="javascript:;" class="backLogin">返回账号登录>></a></div>
</form>
</div>
</div>
</div>
</div>
<div style="text-align:center" id="copyright">
<br/>
Copyright © 2000-2018 东北师大理想软件股份有限公司 版权所有 吉ICP备13001399号-1
</div>
</body>
<script type="text/javascript">
$(function () {
//获取验证码
refreshCaptcha();
//注册登录
$("#loginBtn").click(function () {
doLogin();
});
$("#redirect_uri").val(getUrlParam("redirect_uri"));
$("#client_id").val(getUrlParam("client_id"));
$("#response_type").val(getUrlParam("response_type"));
$("#oauth_callback").val(getUrlParam("oauth_callback"));
});
function doLogin() {
// 公有 key
var pubkey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJq4zg2Wn/A+IZZG/86sTBqgHe\n" +
"RzAPbBoVGhCclqwfqDCYzYts/nK/0Is0Qrsa0ul4M1eRTYBQwqr3OACWjWpLUBYA\n" +
"uavHfUu3t0sez5sIy1hVlX3Ztd9gG1N3s6zMRQULJr8kCjI7k7Ziu5TnxSfg9WCa\n" +
"0+MiRCU6ZfJmWaz2jQIDAQAB";
var encrypt = new JSEncrypt();
encrypt.setPublicKey(pubkey);
var encrypted = encrypt.encrypt($('#passwordTxt').val());
var data = {
"username": $("#usernameTxt").val(),
"password": encrypted,
"value": $("#captchaTxt").val(),
"captchaId": $("#captchaId").val(),
"redirect_uri": $("#redirect_uri").val(),
"client_id": $("#client_id").val(),
"response_type": $("#response_type").val(),
"oauth_callback": $("#oauth_callback").val(),
//设备代码, WEB:1手机2PAD3
"device_id": 1
};
$.ajax({
url: "/oauth2/authorize", //请求的url地址
dataType: "json", //返回格式为json
async: true,//请求是否异步默认为异步这也是ajax重要特性
type: "POST", //请求方式
data: data,
success: function (req) {
console.log(req);
if (req["code"] != 200) {
refreshCaptcha();
alert(req["msg"]);
} else {
window.location.href = req["items"];
}
}
});
}
$(document).keydown(function (event) {
if (event.keyCode == 13) {//回车键对应code值为13
doLogin();
}
});
//获取参数
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null)
return unescape(r[2]);
return null;
}
//获取验证码
function refreshCaptcha() {
$.ajax({
type: "GET",
dataType: "json",
url: "/oauth2/getCaptcha",
async: false,
success: function (result) {
$("#captchaId").val(result.data);
$("#userCaptchaImage").attr("src", "/oauth2/getCaptchaPng?captchaId=" + result.data);
}
});
}
</script>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>长春市教育管理公共服务平台统一认证中心</title>
<link rel="stylesheet" type="text/css" href="./css/style.css"/>
<script type="text/javascript" src="./js/jquery-1.12.4.min.js"></script>
<script src="./js/jsencrypt.min.js" type="text/javascript"></script>
</head>
<body>
<div id="header">
<img src="./images/edusoa.png" style="margin-left: 30px;margin-top: 8px;"/><span
style="font-size:36px;display: block;margin-left: 233px;margin-top: -58px;font-weight:bold"
id="system_name">长春市教育管理公共服务平台统一认证中心</span>
</div>
<div class="login-wrap">
<div class="wrap clearfix">
<img src="./images/login-img.png" style="margin-top: 22px;"/>
<div class="form-box fr loginV2" style="display: block;">
<ul class="form-tab clearfix">
<li class="tab-li cur">
<a href="javascript:;" tjjj="passport.login_type.login_name">账户登录</a></li>
</ul>
<div class="form-con">
<div class="login-normal" style="display: block;">
<form id="nameLoginForm">
<div class="form-error" style="">
<i>
</i>
<label class="text"></label>
</div>
<dl class="clearfix">
<dt><em></em>户:</dt>
<dd>
<input type="text" name="loginName" id="usernameTxt" value="sys1" class="input-text"
autocomplete="off" placeholder="账户名/邮箱/手机号"/></dd>
</dl>
<dl class="top1 clearfix">
<dt><em></em>码:</dt>
<dd>
<input type="password" name="password" id="passwordTxt" value="123456"
class="input-text" placeholder="请输入密码"></dd>
</dl>
<dl class="top2 clearfix">
<dt>验证码:</dt>
<dd>
<input name="smsCaptcha" type="text" id="captchaTxt" class="input-yzm" maxlength="6"
autocomplete="off"/>
<span class="span-yzm">
<img id="userCaptchaImage" title="点击图片刷新校验码" alt="点击图片刷新校验码" style="cursor:pointer"
onclick="javascript:refreshCaptcha()"/>
<a onclick="javascript:refreshCaptcha()" class="forget-pass" style="cursor:pointer">换一张</a></span>
</dd>
</dl>
<div class="btn-box clearfix" style="margin-top: 10px;">
<input id="loginBtn" class="btn-settlement" type="button" value="登 录"
tjjj="passport.button.login"></div>
<input type="hidden" name="captchaId" id="captchaId" value="">
<input type="hidden" name="redirect_uri" id="redirect_uri" value="">
<input type="hidden" name="client_id" id="client_id" value="">
<input type="hidden" name="response_type" id="response_type" value="">
<input type="hidden" name="oauth_callback" id="oauth_callback" value="">
<div class="link-box clearfix">
<a href="javascript:;" id="findPwd" class="forget-pass" tjjj="passport.forget.password">忘记密码?</a>
</div>
</form>
<div class="login-short clearfix">
<div class="short-left">
<h3>第三方账号登录:</h3>
<ul class="clearfix">
<li class="qq">
<!--<a a href="https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=101470748&scope=all&redirect_uri=https://10.10.14.200/dsssoserver/html/jumpQq.html" tjjj="passport.login.thd.login.qq"></a>-->
<a a href="#" tjjj="passport.login.thd.login.qq"></a>
</li>
<li class="weixin">
<a href="https://open.weixin.qq.com/connect/qrconnect?appid=wx3e0449144386938a&redirect_uri=http://fort.edusoa.com:7777/sso/static/jumpWx.html&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect" tjjj="passport.login.thd.login.weixin"></a>
</li>
</ul>
</div>
<div class="short-right">
<h3>您还可以选择:</h3>
<p class="phone-short clearfix">
<i class="phone"></i>
<!--<a href="javascript:;" tjjj="" class="txt phoneLogin">手机快捷登录</a>-->
<a href="#" tjjj="" class="txt phoneLogin">手机快捷登录</a>
</p>
</div>
</div>
</div>
</div>
</div>
<!-- -快捷登录 -->
<div class="form-box fr shortLogin" style="display: none;">
<ul class="form-tab clearfix">
<li class="tab-li cur">
<a href="javascript:;" tjjj="passport.login_type.login_name">手机快捷登录</a></li>
</ul>
<div class="form-con">
<form id="mobileLoginForm">
<div class="form-error" style="">
<i>
</i>
<label class="text"></label>
</div>
<dl class="clearfix">
<dt>手机号:</dt>
<dd>
<input type="text" id="phoneTxt" autocomplete="off" class="input-text mobile" maxlength="11"
placeholder="请输入手机号"/>
</dd>
</dl>
<!--
<dl class="top1 clearfix">
<dt>验证码:</dt>
<dd>
<input name="smsCaptcha" type="text" id="partnerYzm" class="input-yzm" onblur="captchCheck(this);" maxlength="4" autocomplete="off" />
<span class="span-yzm">
<img id="smsCaptchaImage" title="点击图片刷新校验码" alt="点击图片刷新校验码" onclick="changeCode('smsCaptchaImage','partnerYzm');" />
<a href="javascript:changeCode('smsCaptchaImage','partnerYzm');" class="forget-pass">换一张</a></span>
</dd>
</dl>
-->
<dl class="top1 clearfix">
<dt>动态码:</dt>
<dd>
<input name="code" type="text" id="smsCode" class="input-jym" maxlength="6"
autocomplete="off" placeholder="请输入动态码"/>
<a id="smsSendButton" onclick="sendSms();" class="span-jym" style="cursor:pointer"
tjjj="passport.send.msg">发送动态码</a></dd>
</dl>
<div class="btn-box clearfix" style="margin-top: 35px;">
<input id="smsFlagHidden" type="hidden"/>
<input id="smsLoginBtn" class="btn-settlement" type="button" value="登 录"
tjjj="passport.quick.button.login"></div>
<div class="link-box clearfix" style="margin-top: 30px;">
<a href="javascript:;" class="backLogin">返回账号登录>></a></div>
</form>
</div>
</div>
</div>
</div>
<div style="text-align:center" id="copyright">
<br/>
Copyright © 2000-2018 东北师大理想软件股份有限公司 版权所有 吉ICP备13001399号-1
</div>
</body>
<script type="text/javascript">
$(function () {
//获取验证码
refreshCaptcha();
//注册登录
$("#loginBtn").click(function () {
doLogin();
});
$("#redirect_uri").val(getUrlParam("redirect_uri"));
$("#client_id").val(getUrlParam("client_id"));
$("#response_type").val(getUrlParam("response_type"));
$("#oauth_callback").val(getUrlParam("oauth_callback"));
});
function doLogin() {
// 公有 key
var pubkey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJq4zg2Wn/A+IZZG/86sTBqgHe\n" +
"RzAPbBoVGhCclqwfqDCYzYts/nK/0Is0Qrsa0ul4M1eRTYBQwqr3OACWjWpLUBYA\n" +
"uavHfUu3t0sez5sIy1hVlX3Ztd9gG1N3s6zMRQULJr8kCjI7k7Ziu5TnxSfg9WCa\n" +
"0+MiRCU6ZfJmWaz2jQIDAQAB";
var encrypt = new JSEncrypt();
encrypt.setPublicKey(pubkey);
var encrypted = encrypt.encrypt($('#passwordTxt').val());
var data = {
"username": $("#usernameTxt").val(),
"password": encrypted,
"value": $("#captchaTxt").val(),
"captchaId": $("#captchaId").val(),
"redirect_uri": $("#redirect_uri").val(),
"client_id": $("#client_id").val(),
"response_type": $("#response_type").val(),
"oauth_callback": $("#oauth_callback").val(),
//设备代码, WEB:1手机2PAD3
"device_id": 1
};
$.ajax({
url: "/oauth2/authorize", //请求的url地址
dataType: "json", //返回格式为json
async: true,//请求是否异步默认为异步这也是ajax重要特性
type: "POST", //请求方式
data: data,
success: function (req) {
console.log(req);
if (req["code"] != 200) {
refreshCaptcha();
alert(req["msg"]);
} else {
window.location.href = req["items"];
}
}
});
}
$(document).keydown(function (event) {
if (event.keyCode == 13) {//回车键对应code值为13
doLogin();
}
});
//获取参数
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null)
return unescape(r[2]);
return null;
}
//获取验证码
function refreshCaptcha() {
$.ajax({
type: "GET",
dataType: "json",
url: "/oauth2/getCaptcha",
async: false,
success: function (result) {
$("#captchaId").val(result.data);
$("#userCaptchaImage").attr("src", "/oauth2/getCaptchaPng?captchaId=" + result.data);
}
});
}
</script>
</html>

@ -0,0 +1,72 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="./js/jquery-1.12.4.min.js"></script>
<script src="./js/base64.js" type="text/javascript"></script>
<script src="./js/aes.js" type="text/javascript"></script>
<script src="./js/persist-min.js"></script>
</head>
<body>
</body>
<script type="text/javascript">
$(function () {
var code = getUrlParam("code");
var default_redirect_url = getDefaultRedirectUrl();
var store = new Persist.Store('store_name');
$.ajax({
type: "POST",
dataType: "json",
url: "/sso/oauth2/wxLogin",
data: {
"code": code
},
async: false,
success: function (result) {
var open_id = Base64.encode(aesEncrypt(result.openid));
alert(open_id);
if (result.success) {
//window.location.href = store.get("url") + "?ds_sso_sessionid=" + result.sessionId;
//store.set("url","")
} else {
//window.location.href = "bindUser.html?open_id="+open_id+"&type_id="+aesEncrypt("2")+"&redirect_url="+default_redirect_url;
}
}
});
});
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null)
return unescape(r[2]);
return null;
}
function getDefaultRedirectUrl() {
var DefaultRedirectUrl = "";
$.ajax({
type: "GET",
dataType: "json",
url: "/dsssoserver/third/getQqWxRedirectUrl",
async: false,
success: function (result) {
if (result.success) {
DefaultRedirectUrl = result.defaultRedirectUrl;
}
}
});
return DefaultRedirectUrl;
}
//aes加密
function aesEncrypt(content) {
var srcs = CryptoJS.enc.Utf8.parse(content);
var encrypted = CryptoJS.AES.encrypt(srcs, {mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7});
return encrypted.toString();
}
</script>
</html>
Loading…
Cancel
Save