Pepguy commited on
Commit
f14a8fb
·
verified ·
1 Parent(s): 0b75163

Update reset.html

Browse files
Files changed (1) hide show
  1. reset.html +9 -7
reset.html CHANGED
@@ -71,17 +71,18 @@
71
  </div>
72
 
73
  <script>
74
- /* const SUPABASE_URL = "https://sabzdinksnhtxkmuifhu.supabase.co"; // <-- replace
75
  const SUPABASE_ANON_KEY = "sb_publishable_cnPXh7btnMgXgSh1uP2WHw_8254URhU"; // <-- replace
76
  const supabase = supabase.createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
77
- */
78
 
79
- const SUPABASE_URL = "https://sabzdinksnhtxkmuifhu.supabase.co";
 
80
  const SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNhYnpkaW5rc25odHhrbXVpZmh1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MzE0NDYwMTIsImV4cCI6MjA0NzAyMjAxMn0.f0g8rrFDCELdKm4h0iEgX-0CXUY4dUHYOBk1wxf-c7I";
81
 
82
  // Use window.supabase (the global from CDN) instead of const supabase
83
  const { createClient } = window.supabase;
84
  const supabaseClient = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
 
85
 
86
  const resetBtn = document.getElementById("resetBtn");
87
  const messageDiv = document.getElementById("message");
@@ -94,17 +95,18 @@ const supabaseClient = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
94
  params[key] = decodeURIComponent(value);
95
  });
96
 
97
- alert(params.type === "recovery" && params.access_token);
98
 
99
  if (params.type === "recovery" && params.access_token) {
100
  // automatically sign in using recovery token
101
- const { data, error } = await supabaseClient.auth.setSession({
102
  access_token: params.access_token,
103
  refresh_token: params.refresh_token
104
  });
105
 
106
  if (error) {
107
- messageDiv.textContent = "Invalid or expired link.";
 
108
  messageDiv.classList.add("error");
109
  resetBtn.disabled = true;
110
  }
@@ -122,7 +124,7 @@ const supabaseClient = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
122
  resetBtn.disabled = true;
123
  messageDiv.textContent = "Updating password...";
124
 
125
- const { data, error } = await supabaseClient.auth.updateUser({ password });
126
 
127
  if (error) {
128
  messageDiv.textContent = error.message;
 
71
  </div>
72
 
73
  <script>
74
+ const SUPABASE_URL = "https://sabzdinksnhtxkmuifhu.supabase.co"; // <-- replace
75
  const SUPABASE_ANON_KEY = "sb_publishable_cnPXh7btnMgXgSh1uP2WHw_8254URhU"; // <-- replace
76
  const supabase = supabase.createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
 
77
 
78
+
79
+ /* const SUPABASE_URL = "https://sabzdinksnhtxkmuifhu.supabase.co";
80
  const SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNhYnpkaW5rc25odHhrbXVpZmh1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MzE0NDYwMTIsImV4cCI6MjA0NzAyMjAxMn0.f0g8rrFDCELdKm4h0iEgX-0CXUY4dUHYOBk1wxf-c7I";
81
 
82
  // Use window.supabase (the global from CDN) instead of const supabase
83
  const { createClient } = window.supabase;
84
  const supabaseClient = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
85
+ */
86
 
87
  const resetBtn = document.getElementById("resetBtn");
88
  const messageDiv = document.getElementById("message");
 
95
  params[key] = decodeURIComponent(value);
96
  });
97
 
98
+ // alert(params.type === "recovery" && params.access_token);
99
 
100
  if (params.type === "recovery" && params.access_token) {
101
  // automatically sign in using recovery token
102
+ const { data, error } = await supabase.auth.setSession({
103
  access_token: params.access_token,
104
  refresh_token: params.refresh_token
105
  });
106
 
107
  if (error) {
108
+ messageDiv.textContent = `${error}`;
109
+ // messageDiv.textContent = "Invalid or expired link.";
110
  messageDiv.classList.add("error");
111
  resetBtn.disabled = true;
112
  }
 
124
  resetBtn.disabled = true;
125
  messageDiv.textContent = "Updating password...";
126
 
127
+ const { data, error } = await supabase.auth.updateUser({ password });
128
 
129
  if (error) {
130
  messageDiv.textContent = error.message;