casdoor 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/match.js +4 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "casdoor",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "The Casdoor extension can help browser users automatically log into applications protected by Casdoor single-sign-on (SSO) system.",
5
5
  "repository": {
6
6
  "type": "git",
package/src/match.js CHANGED
@@ -13,7 +13,8 @@
13
13
  // limitations under the License.
14
14
 
15
15
  // The sign-in page patterns of form autofill, matched the same way as Casdoor matches them (object/form_fill.go):
16
- // the host has to be the same, "*.example.com" covers the subdomains, and a path without "*" is a prefix.
16
+ // the host has to be the same, "*.example.com" covers the subdomains, a path without "*" is a prefix, and the part
17
+ // after "#" is compared only when the pattern has it.
17
18
 
18
19
  function splitFormFillUrl(value) {
19
20
  value = (value || "").trim();
@@ -66,7 +67,8 @@ function matchFormFillUrl(pattern, pageUrl) {
66
67
  if (!matchFormFillHost(patternHost, pageHost)) {
67
68
  return false;
68
69
  }
69
- const pagePath = fullPagePath.split("#")[0];
70
+ // the fragment only counts when the pattern has one, like the "#/login" route of a single-page application
71
+ const pagePath = patternPath.includes("#") ? fullPagePath : fullPagePath.split("#")[0];
70
72
  if (!patternPath.includes("*")) {
71
73
  return pagePath.startsWith(patternPath);
72
74
  }