Compare commits

...

5 Commits

Author SHA1 Message Date
Glenn Thompson f498008d2a Merge remote-tracking branch 'upstream/main' 2025-11-15 18:43:48 +03:00
Luis Pereira 8b33968011 fix: failed register error messages 2025-11-15 08:23:31 -05:00
Luis Pereira 6f3973e86a fix: invalid login error on template 2025-11-15 08:23:31 -05:00
Luis Pereira 355655e8eb fix: styling of audio player on chrome browsers 2025-11-15 08:21:10 -05:00
Glenn Thompson 8b0e494da9 fix: Replace undefined uri-path with radiance:path
The previous commit used uri-path() which doesn't exist in Radiance.
This caused 'The function ASTEROID::URI-PATH is undefined' errors
when trying to authenticate.

Changed to use radiance:path() which is the correct Radiance API
function for extracting the path component from a URI object.

Fixes authentication in both require-authentication and require-role.
2025-11-14 06:57:42 -05:00
7 changed files with 83 additions and 17 deletions

View File

@ -719,7 +719,9 @@
(cond
;; Validate passwords match
((not (string= password confirm-password))
(render-template-with-plist "register"
(format t "Failed to register new user '~a': passwords do not match.~%" username)
(clip:process-to-string
(load-template "register")
:title "Asteroid Radio - Register"
:display-error "display: block;"
:display-success "display: none;"
@ -728,7 +730,9 @@
;; Check if username already exists
((find-user-by-username username)
(render-template-with-plist "register"
(format t "Failed to register new user '~a': Username already exists.~%" username)
(clip:process-to-string
(load-template "register")
:title "Asteroid Radio - Register"
:display-error "display: block;"
:display-success "display: none;"
@ -746,14 +750,16 @@
(setf (session:field "user-id") (if (listp user-id) (first user-id) user-id)))))
;; Redirect new users to their profile page
(radiance:redirect "/asteroid/profile"))
(render-template-with-plist "register"
(clip:process-to-string
(load-template "register")
:title "Asteroid Radio - Register"
:display-error "display: block;"
:display-success "display: none;"
:error-message "Registration failed. Please try again."
:success-message ""))))
;; Show registration form (no POST data)
(render-template-with-plist "register"
(clip:process-to-string
(load-template "register")
:title "Asteroid Radio - Register"
:display-error "display: none;"
:display-success "display: none;"

View File

@ -33,12 +33,16 @@
(format t "Session error: ~a~%" e)
"Login successful but session error occurred")))
;; Login failed - show form with error
(render-template-with-plist "login"
:title "Asteroid Radio - Login"
:error-message "Invalid username or password"
:display-error "display: block;")))
(progn
(format t "Login unsuccessful for user: ~a~%" username)
(clip:process-to-string
(load-template "login")
:title "Asteroid Radio - Login"
:error-message "Invalid username or password"
:display-error "display: block;"))))
;; Show login form (no POST data)
(render-template-with-plist "login"
(clip:process-to-string
(load-template "login")
:title "Asteroid Radio - Login"
:error-message ""
:display-error "display: none;"))))

View File

@ -270,6 +270,34 @@ body .audio-player{
text-align: center;
}
body audio::-webkit-media-controls-panel{
background-color: #1a1a1a;
}
body audio::-webkit-media-controls-current-time-display,
body audio::-webkit-media-controls-time-remaining-display{
color: #fff;
}
body audio::-webkit-media-controls-enclosure{
border-radius: 0;
}
body audio::-webkit-media-controls-mute-button,
body audio::-webkit-media-controls-play-button,
body audio::-webkit-media-controls-volume-slider,
body audio::-webkit-media-controls-timeline,
body audio::-webkit-media-controls-toggle-closed-captions-button,
body audio::-webkit-media-controls-fullscreen-button,
body audio::-webkit-media-controls-timeline,
body audio::-webkit-media-controls-overlay-enclosure{
-moz-filter: invert(1);
-o-filter: invert(1);
-webkit-filter: invert(1);
-ms-filter: invert(1);
filter: invert(1);
}
body .track-art{
font-size: 3em;
margin-right: 20px;

View File

@ -218,6 +218,34 @@
(.audio-player
:text-align center)
((:and audio |::-webkit-media-controls-panel|)
:background-color "#1a1a1a")
;; ((:and audio (:or |::-webkit-media-controls-mute-button|
;; |::-webkit-media-controls-play-button|
;; |::-webkit-media-controls-current-time-display|
;; |::-webkit-media-controls-time-remaining-display|
;; ))
;; :height "20px"
;; :line-height "20px")
((:and audio (:or |::-webkit-media-controls-current-time-display|
|::-webkit-media-controls-time-remaining-display|))
:color "#fff")
((:and audio |::-webkit-media-controls-enclosure|)
:border-radius 0)
((:and audio (:or |::-webkit-media-controls-mute-button|
|::-webkit-media-controls-play-button|
|::-webkit-media-controls-volume-slider|
|::-webkit-media-controls-timeline|
|::-webkit-media-controls-toggle-closed-captions-button|
|::-webkit-media-controls-fullscreen-button|
|::-webkit-media-controls-timeline|
|::-webkit-media-controls-overlay-enclosure|))
:filter "invert(1)")
(.track-art
:font-size "3em"
:margin-right "20px"

View File

@ -21,8 +21,8 @@
<div class="auth-container">
<div class="auth-form">
<h2>System Access</h2>
<div class="message error" data-attr="style" data-attr-value="display-error" style="display: none;">
<span data-text="error-message">Invalid username or password</span>
<div class="message error" lquery="(attr :style display-error)" style="display: none;">
<span data-text="error-message" lquery="(text error-message)">Invalid username or password</span>
</div>
<form method="post" action="/asteroid/login">
<div class="form-group">

View File

@ -21,11 +21,11 @@
<div class="auth-container">
<div class="auth-form">
<h2>Create Account</h2>
<div class="message error" data-attr="style" data-attr-value="display-error" style="display: none;">
<span data-text="error-message">Registration failed</span>
<div class="message error" lquery="(attr :style display-error)" style="display: none;">
<span lquery="(text error-message)">Registration failed</span>
</div>
<div class="message success" data-attr="style" data-attr-value="display-success" style="display: none;">
<span data-text="success-message">Registration successful!</span>
<div class="message success" lquery="(attr :style display-success)" style="display: none;">
<span lquery="(text success-message)">Registration successful!</span>
</div>
<form method="post" action="/asteroid/register">
<div class="form-group">

View File

@ -175,7 +175,7 @@
If :api t, returns JSON error (401). Otherwise redirects to login page.
Auto-detects API routes if not specified."
(let* ((user-id (session:field "user-id"))
(uri (uri-path (radiance:uri *request*)))
(uri (radiance:path (radiance:uri *request*)))
;; Use explicit flag if provided, otherwise auto-detect from URI
(is-api-request (if api t (search "/api/" uri))))
(format t "Authentication check - User ID: ~a, URI: ~a, Is API: ~a~%"
@ -202,7 +202,7 @@
If :api t, returns JSON error (403). Otherwise redirects to login page.
Auto-detects API routes if not specified."
(let* ((current-user (get-current-user))
(uri (uri-path (radiance:uri *request*)))
(uri (radiance:path (radiance:uri *request*)))
;; Use explicit flag if provided, otherwise auto-detect from URI
(is-api-request (if api t (search "/api/" uri))))
(format t "Current user for role check: ~a~%" (if current-user "FOUND" "NOT FOUND"))