feat:登录

This commit is contained in:
dzc committed 2025-01-06 18:15:07 +08:00
1 parent 0088fe3509
commit 8cfe87e31e
8 files changed
+5048 -3914

No files matched your search

+16 -10
View File
@@ -1,8 +1,8 @@
import request from "@/sheep/utils/request";
import { encryptionBase64 } from "@/sheep/utils/util";
import { encryption } from "@/sheep/utils/encryption";
const basicAuth = "Basic " + encryptionBase64(import.meta.env.VITE_OAUTH2_APP_CLIENT);
const basicAuthzzdsh = "Basic " + encryptionBase64(import.meta.env.VITE_OAUTH2_ZZDSHAPP_CLIENT);
const basicAuth =
"Basic " + window.btoa(import.meta.env.VITE_OAUTH2_APP_CLIENT);
export default {
userInfo: () =>
@@ -44,17 +44,23 @@ export default {
},
}),
login: (params: any): any => {
params.scene = "account";
params.grant_type = "password";
params.scope = "server";
params.code = "";
request({
const { username, password, randomStr, code, grant_type, scope } = params;
const encPassword = encryption(password, import.meta.env.VITE_PWD_ENC_KEY);
return request({
url: `/auth/oauth2/token`,
method: "POST",
params,
params: {
username,
password: encPassword,
randomStr,
code,
grant_type,
scope,
},
data: { password: encPassword },
header: {
skipToken: true,
Authorization: basicAuth,
// Authorization: basicAuthzzdsh,
"content-type": "application/x-www-form-urlencoded",
},
custom: {