Parcourir la source

Fix Safari password save prompt issue in Wizard

If there's a filled-in password field in the Wizard, Safari prompts the
user to store it in keychain every time any input is changed, due to the
Wizard's URL changing on each input change.

As a temporary workaround, the Wizard URL no longer changes for Safari,
meaning the Wizard page can no longer be refreshed while keeping all the
filled values and can no longer be bookmarked.
Sergiu Miclea il y a 6 ans
Parent
commit
81ac31013c
2 fichiers modifiés avec 7 ajouts et 1 suppressions
  1. 3 1
      src/sources/WizardSource.js
  2. 4 0
      src/utils/DomUtils.js

+ 3 - 1
src/sources/WizardSource.js

@@ -19,6 +19,8 @@ import notificationStore from '../stores/NotificationStore'
 import { OptionsSchemaPlugin } from '../plugins/endpoint'
 import { OptionsSchemaPlugin } from '../plugins/endpoint'
 
 
 import { servicesUrl } from '../constants'
 import { servicesUrl } from '../constants'
+import DomUtils from '../utils/DomUtils'
+
 import type { WizardData } from '../types/WizardData'
 import type { WizardData } from '../types/WizardData'
 import type { StorageMap } from '../types/Endpoint'
 import type { StorageMap } from '../types/Endpoint'
 import type { MainItem } from '../types/MainItem'
 import type { MainItem } from '../types/MainItem'
@@ -95,7 +97,7 @@ class WizardSource {
 
 
   setUrlState(data: any) {
   setUrlState(data: any) {
     let locationExp = /.*?(?:\?|$)/.exec(window.location.href)
     let locationExp = /.*?(?:\?|$)/.exec(window.location.href)
-    if (!locationExp) {
+    if (!locationExp || DomUtils.isSafari()) {
       return
       return
     }
     }
     let location = locationExp[0].replace('?', '')
     let location = locationExp[0].replace('?', '')

+ 4 - 0
src/utils/DomUtils.js

@@ -150,6 +150,10 @@ class DomUtils {
       return `<span class="${cls}">${match}</span>`
       return `<span class="${cls}">${match}</span>`
     })
     })
   }
   }
+
+  static isSafari() {
+    return navigator.userAgent.indexOf('Chrome') === -1 && navigator.userAgent.indexOf('Safari') > -1
+  }
 }
 }
 
 
 export default DomUtils
 export default DomUtils