casdoor 1.0.1 → 1.0.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "casdoor",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "The Casdoor extension can help browser users automatically log into applications protected by Casdoor single-sign-on (SSO) system.",
5
5
  "scripts": {
6
6
  "semantic-release": "semantic-release"
package/src/oauth.js CHANGED
@@ -40,6 +40,7 @@ function login() {
40
40
  .getUserProfile(accessToken)
41
41
  .then((userProfile) => displayUserProfile(userProfile));
42
42
  });
43
+ setInputDisabledState(true, "endpoint", "applicationName")
43
44
  } else {
44
45
  alert("Login failed!");
45
46
  }
@@ -49,6 +50,7 @@ function login() {
49
50
  // eslint-disable-next-line no-unused-vars
50
51
  function logout() {
51
52
  chrome.storage.sync.set({accessToken: ""}, () => clearUserProfile());
53
+ setInputDisabledState(false, "endpoint", "applicationName")
52
54
  }
53
55
 
54
56
  function displayUserProfile(userProfile) {
@@ -63,3 +65,14 @@ function clearUserProfile() {
63
65
  document.getElementById("user").innerHTML = "";
64
66
  document.getElementById("loginOrLogout").innerText = "Login";
65
67
  }
68
+
69
+ function setInputDisabledState(disabledState, ...elementIds) {
70
+ elementIds.forEach(elementId => {
71
+ const inputElement = document.getElementById(elementId);
72
+ if (inputElement) {
73
+ inputElement.disabled = disabledState;
74
+ } else {
75
+ console.warn(`No element found with ID: ${elementId}`);
76
+ }
77
+ });
78
+ }
package/src/popup.js CHANGED
@@ -40,6 +40,7 @@ document.addEventListener("DOMContentLoaded", function() {
40
40
  const managedAccounts = account.data.managedAccounts;
41
41
  chrome.storage.sync.set({managedAccounts});
42
42
  });
43
+ setInputDisabledState(true, "endpoint", "applicationName")
43
44
  } else {
44
45
  clearUserProfile();
45
46
  }
package/src/sdk.js CHANGED
@@ -31,7 +31,7 @@ class Sdk {
31
31
  getSignInUrl(clientId) {
32
32
  const endpoint = this.config.endpoint;
33
33
  const redirectUri = this.getRedirectUri();
34
- const scope = "openid";
34
+ const scope = "profile";
35
35
  const state = this.config.applicationName;
36
36
  return `${endpoint}/login/oauth/authorize?client_id=${clientId}&response_type=token&redirect_uri=${redirectUri}&scope=${scope}&state=${state}`;
37
37
  }