feat: 飞书扫码登录

This commit is contained in:
fit2cloud-chenyw 2023-11-22 22:32:10 +08:00
parent a8e9cc8843
commit 076e3ced48
6 changed files with 44 additions and 2 deletions

View File

@ -0,0 +1,22 @@
export const loadScript = (url: string, jsId?: string) => {
return new Promise(function (resolve, reject) {
const scriptId = jsId || 'de-fit2cloud-script-id'
let dom = document.getElementById(scriptId)
if (dom) {
dom.parentElement?.removeChild(dom)
dom = null
}
const script = document.createElement('script')
script.id = scriptId
script.onload = function () {
return resolve(null)
}
script.onerror = function () {
return reject(new Error('Load script from '.concat(url, ' failed')))
}
script.src = url
const head = document.head || document.getElementsByTagName('head')[0]
;(document.body || head).appendChild(script)
})
}

@ -1 +1 @@
Subproject commit 3b92a9102173342ea3d49f9dd5d9bc38f9589257
Subproject commit 91e4019972ec96f7f672bb5da2156f54ca9d72ea

View File

@ -1,5 +1,6 @@
package io.dataease.api.lark.api;
import io.dataease.api.lark.dto.LarkTokenRequest;
import io.dataease.api.lark.vo.LarkInfoVO;
import io.dataease.api.lark.dto.LarkSettingCreator;
import org.springframework.web.bind.annotation.GetMapping;
@ -14,4 +15,7 @@ public interface LarkApi {
@PostMapping("/create")
void save(@RequestBody LarkSettingCreator creator);
@PostMapping("/token")
String larkToken(@RequestBody LarkTokenRequest request);
}

View File

@ -0,0 +1,13 @@
package io.dataease.api.lark.dto;
import lombok.Data;
import java.io.Serializable;
@Data
public class LarkTokenRequest implements Serializable {
private String code;
private String state;
}

View File

@ -148,7 +148,7 @@ public class HttpClientUtil {
public static String post(String url, String json, HttpClientConfig config) {
CloseableHttpClient httpClient = null;
try {
buildHttpClient(url);
httpClient = buildHttpClient(url);
HttpPost httpPost = new HttpPost(url);
if (config == null) {
config = new HttpClientConfig();

View File

@ -19,6 +19,8 @@ public class WhitelistUtils {
"/swagger-resources",
"/doc.html",
"/panel.html",
"/lark/info",
"/lark/token",
"/setting/authentication/status",
"/");
@ -34,6 +36,7 @@ public class WhitelistUtils {
|| StringUtils.startsWithAny(requestURI, "/static-resource/")
|| StringUtils.startsWithAny(requestURI, "/share/proxyInfo")
|| StringUtils.startsWithAny(requestURI, "/xpackComponent/content/")
|| StringUtils.startsWithAny(requestURI, "/platform/")
|| StringUtils.startsWithAny(requestURI, "/map/");
}
}