File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,6 +137,19 @@ async function sendMagicLink(email) {
137137 return true ; // success
138138}
139139
140+ // Login using email and password
141+ async function login ( email , password ) {
142+ var result = await sb . auth . signInWithPassword ( {
143+ email : email ,
144+ password : password
145+ } ) ;
146+
147+ if ( result . error ) {
148+ throw result . error ;
149+ }
150+
151+ return result . data ;
152+ }
140153
141154// ============================================================
142155// EXPOSE FUNCTIONS TO OTHER SCRIPTS
@@ -164,7 +177,6 @@ window.XAYTHEON_AUTH = {
164177 login : login
165178} ;
166179
167-
168180// ============================================================
169181// INITIALIZE WHEN THE PAGE IS READY
170182// ============================================================
Original file line number Diff line number Diff line change @@ -530,7 +530,6 @@ <h4>Email Address (user:email)</h4>
530530 </ div >
531531 </ div >
532532 </ div >
533-
534533 <!-- Inline JS -->
535534 < script >
536535document . addEventListener ( "DOMContentLoaded" , function ( ) {
@@ -569,6 +568,7 @@ <h4>Email Address (user:email)</h4>
569568</ script >
570569
571570
571+ < script src ="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2 "> </ script >
572572
573573 < script src ="auth.js?v=1.0.0 "> </ script >
574574 < script >
@@ -632,6 +632,17 @@ <h4>Email Address (user:email)</h4>
632632 statusEl . className = "success-msg" ;
633633 statusEl . textContent = message ;
634634 }
635+ function getAuthErrorMessage ( error ) {
636+ if ( ! error ) {
637+ return "Authentication failed." ;
638+ }
639+
640+ if ( error . code === "INVALID_CREDENTIALS" ) {
641+ return "Invalid email or password." ;
642+ }
643+
644+ return error . message || "Authentication failed." ;
645+ }
635646
636647 function setLoading ( isLoading ) {
637648 submitBtn . disabled = isLoading ;
Original file line number Diff line number Diff line change 1+ function safeHtml ( str ) {
2+ return String ( str )
3+ . replaceAll ( "&" , "&" )
4+ . replaceAll ( "<" , "<" )
5+ . replaceAll ( ">" , ">" )
6+ . replaceAll ( '"' , """ )
7+ . replaceAll ( "'" , "'" ) ;
8+ }
9+
10+ function safeAttr ( url ) {
11+ try {
12+ return encodeURI ( url ) ;
13+ } catch {
14+ return "#" ;
15+ }
16+ }
117// ============================================================
218// script.js - 3D Background + GitHub Dashboard
319// ============================================================
You can’t perform that action at this time.
0 commit comments