Update reset.html
Browse files- reset.html +6 -6
reset.html
CHANGED
|
@@ -71,18 +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 |
|
| 87 |
const resetBtn = document.getElementById("resetBtn");
|
| 88 |
const messageDiv = document.getElementById("message");
|
|
@@ -99,7 +99,7 @@ const supabaseClient = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
|
|
| 99 |
|
| 100 |
if (params.type === "recovery" && params.access_token) {
|
| 101 |
// automatically sign in using recovery token
|
| 102 |
-
const { data, error } = await
|
| 103 |
access_token: params.access_token,
|
| 104 |
refresh_token: params.refresh_token
|
| 105 |
});
|
|
@@ -124,7 +124,7 @@ const supabaseClient = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
|
|
| 124 |
resetBtn.disabled = true;
|
| 125 |
messageDiv.textContent = "Updating password...";
|
| 126 |
|
| 127 |
-
const { data, error } = await
|
| 128 |
|
| 129 |
if (error) {
|
| 130 |
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");
|
|
|
|
| 99 |
|
| 100 |
if (params.type === "recovery" && params.access_token) {
|
| 101 |
// automatically sign in using recovery token
|
| 102 |
+
const { data, error } = await supabaseClient.auth.setSession({
|
| 103 |
access_token: params.access_token,
|
| 104 |
refresh_token: params.refresh_token
|
| 105 |
});
|
|
|
|
| 124 |
resetBtn.disabled = true;
|
| 125 |
messageDiv.textContent = "Updating password...";
|
| 126 |
|
| 127 |
+
const { data, error } = await supabaseClient.auth.updateUser({ password });
|
| 128 |
|
| 129 |
if (error) {
|
| 130 |
messageDiv.textContent = error.message;
|