fix: failed register error messages

This commit is contained in:
Luis Pereira 2025-11-14 23:04:15 +00:00 committed by Brian O'Reilly
parent 6f3973e86a
commit 8b33968011
2 changed files with 14 additions and 8 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

@ -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">