megacommit

This commit is contained in:
2025-10-11 01:52:21 +01:00
parent f6bd540c99
commit 6092d1d7b4
690 changed files with 91734 additions and 303 deletions
+40 -8
View File
@@ -9,7 +9,7 @@
<body>
<div class="signup-container">
<div class="signup-header">
<div class="logo">DC</div>
<img src="/static/favicon.ico" class="logo"/>
<h1>Create Account</h1>
<p>Join the conversation today</p>
</div>
@@ -87,6 +87,27 @@
<div class="error-message">Passwords do not match</div>
</div>
<div class="form-group">
<label for="accessToken">Enter Access Token</label>
<div class="input-wrapper">
<input
type="password"
id="accessToken"
name="accessToken"
placeholder="Enter your access token"
required
/>
<button
type="button"
class="password-toggle"
id="accessTokenToggle"
>
SHOW
</button>
</div>
<div class="error-message">Passwords do not match</div>
</div>
<div class="checkbox-group">
<input type="checkbox" id="terms" name="terms" required />
<label for="terms">
@@ -111,6 +132,7 @@
email: document.getElementById("email"),
password: document.getElementById("password"),
confirmPassword: document.getElementById("confirmPassword"),
accessToken: document.getElementById("accessToken"),
terms: document.getElementById("terms"),
};
@@ -170,6 +192,13 @@
return isValid;
}
function validateAccessToken() {
const value = form.accessToken.value.trim();
const isValid = value.length >= 3;
toggleError(form.accessToken, !isValid);
return isValid;
}
function toggleError(input, hasError) {
const formGroup = input.closest(".form-group");
if (hasError) {
@@ -183,6 +212,7 @@
form.username.addEventListener("blur", validateUsername);
form.email.addEventListener("blur", validateEmail);
form.password.addEventListener("blur", validatePassword);
form.password.addEventListener("blur", validateAccessToken);
form.confirmPassword.addEventListener(
"blur",
validateConfirmPassword,
@@ -194,6 +224,7 @@
const isUsernameValid = validateUsername();
const isEmailValid = validateEmail();
const isPasswordValid = validatePassword();
const isAccessTokenValid = validateAccessToken();
const isConfirmPasswordValid = validateConfirmPassword();
const areTermsAccepted = form.terms.checked;
@@ -201,6 +232,7 @@
!isUsernameValid ||
!isEmailValid ||
!isPasswordValid ||
!isAccessTokenValid ||
!isConfirmPasswordValid ||
!areTermsAccepted
) {
@@ -218,8 +250,9 @@
// Prepare data
const formData = {
username: form.username.value.trim(),
// email: form.email.value.trim(),
password: form.password.value,
email: form.email.value.trim(),
password: form.password.value.trim(),
access_token: form.accessToken.value.trim(),
};
try {
@@ -242,12 +275,11 @@
// Optional: Redirect after success
setTimeout(() => {
window.location.href = '/chat';
// console.log("Redirecting to chat...");
}, 2000);
window.location.replace('/chat');
}, 1000);
} else {
const error = await response.json();
throw new Error(error.message || "Signup failed");
const error = await response.text();
throw new Error(error || "Signup failed");
}
} catch (error) {
console.error("Signup error:", error);