diff --git a/controllers/AccountController.go b/controllers/AccountController.go index 2d3e34b1..f7e1f08b 100644 --- a/controllers/AccountController.go +++ b/controllers/AccountController.go @@ -37,6 +37,7 @@ func (c *AccountController) Prepare() { c.Data["xsrfdata"] = template.HTML(c.XSRFFormHTML()) c.Data["corpID"] = beego.AppConfig.String("dingtalk_corpid") c.Data["ENABLE_QR_DINGTALK"] = (beego.AppConfig.String("dingtalk_corpid") != "") + c.Data["dingtalk_qr_key"] = beego.AppConfig.String("dingtalk_qr_key") if !c.EnableXSRF { return diff --git a/static/js/dingtalk-ddlogin.js b/static/js/dingtalk-ddlogin.js new file mode 100644 index 00000000..f62433be --- /dev/null +++ b/static/js/dingtalk-ddlogin.js @@ -0,0 +1,18 @@ +!function (window, document) { + function d(a) { + var e, c = document.createElement("iframe"), + d = "https://login.dingtalk.com/login/qrcode.htm?goto=" + a.goto ; + d += a.style ? "&style=" + encodeURIComponent(a.style) : "", + d += a.href ? "&href=" + a.href : "", + c.src = d, + c.frameBorder = "0", + c.allowTransparency = "true", + c.scrolling = "no", + c.width = a.width ? a.width + 'px' : "365px", + c.height = a.height ? a.height + 'px' : "400px", + e = document.getElementById(a.id), + e.innerHTML = "", + e.appendChild(c) + } + window.DDLogin = d +}(window, document); \ No newline at end of file diff --git a/views/account/login.tpl b/views/account/login.tpl index a7123fd1..2129f7b5 100644 --- a/views/account/login.tpl +++ b/views/account/login.tpl @@ -72,7 +72,7 @@ {{if .ENABLE_QR_DINGTALK}}
{{end}} {{if .ENABLED_REGISTER}} @@ -83,6 +83,10 @@ {{end}} {{end}} + @@ -92,6 +96,8 @@ + + + + +