@@ -141,7 +141,7 @@ import QrCodeTab from '@/views/login/scanCompinents/QrCodeTab.vue'
141141import {MsgConfirm , MsgError } from ' @/utils/message.ts'
142142import * as dd from ' dingtalk-jsapi'
143143import {loadScript } from ' @/utils/common'
144- import CryptoJS from ' crypto-js ' ;
144+ import forge from ' node-forge ' ;
145145
146146const router = useRouter ()
147147const {login, user, theme} = useStore ()
@@ -200,9 +200,11 @@ const loginHandle = () => {
200200 loading .value = false
201201 })
202202 } else {
203- loginForm .value .password = CryptoJS .MD5 (loginForm .value .password .trim ()).toString (CryptoJS .enc .Hex )
203+ const publicKey = forge .pki .publicKeyFromPem (user .rasKey );
204+ const encrypted = publicKey .encrypt (JSON .stringify (loginForm .value ), ' RSAES-PKCS1-V1_5' );
205+ const encryptedBase64 = forge .util .encode64 (encrypted );
204206 login
205- .asyncLogin (loginForm .value )
207+ .asyncLogin ({encryptedData: encryptedBase64 , username: loginForm .value . username } )
206208 .then (() => {
207209 locale .value = localStorage .getItem (' MaxKB-locale' ) || getBrowserLang () || ' en-US'
208210 localStorage .setItem (' workspace_id' , ' default' )
@@ -298,7 +300,7 @@ onBeforeMount(() => {
298300 } else {
299301 authSetting .value = {
300302 max_attempts: 1 ,
301- default_value: ' password ' ,
303+ default_value: ' LOCAL ' ,
302304 }
303305 }
304306 const params = route .query
@@ -315,7 +317,7 @@ onBeforeMount(() => {
315317 } else {
316318 authSetting .value = {
317319 max_attempts: 1 ,
318- default_value: ' password ' ,
320+ default_value: ' LOCAL ' ,
319321 }
320322 }
321323 })
@@ -351,7 +353,7 @@ const newDefaultSlogan = computed(() => {
351353})
352354
353355function redirectAuth(authType : string , needMessage : boolean = true ) {
354- if (authType === ' LDAP' || authType === ' ' || authType === ' password ' ) {
356+ if (authType === ' LDAP' || authType === ' ' || authType === ' LOCAL ' ) {
355357 return
356358 }
357359 authApi .getLoginViewAuthSetting (authType , loading ).then ((res : any ) => {
0 commit comments