OhMyDitzzy
commited on
Commit
ยท
1078fbb
1
Parent(s):
97069a3
anything
Browse files
src/modules/register/RegisterPage.tsx
CHANGED
|
@@ -18,7 +18,6 @@ export function RegisterPage() {
|
|
| 18 |
const [sessionValid, setSessionValid] = useState<boolean | null>(null);
|
| 19 |
const [loading, setLoading] = useState(true);
|
| 20 |
const [submitting, setSubmitting] = useState(false);
|
| 21 |
-
const [skipPassword, setSkipPassword] = useState(false);
|
| 22 |
|
| 23 |
const [formData, setFormData] = useState<RegistrationData>({
|
| 24 |
username: "",
|
|
@@ -132,18 +131,16 @@ export function RegisterPage() {
|
|
| 132 |
newErrors.age = "Age must be between 13 and 100";
|
| 133 |
}
|
| 134 |
|
| 135 |
-
if (!
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
newErrors.confirmPassword = "Passwords do not match";
|
| 146 |
-
}
|
| 147 |
}
|
| 148 |
|
| 149 |
setErrors(newErrors);
|
|
@@ -166,8 +163,8 @@ export function RegisterPage() {
|
|
| 166 |
const submitData = {
|
| 167 |
username: formData.username.trim(),
|
| 168 |
age: parseInt(formData.age),
|
| 169 |
-
password:
|
| 170 |
-
confirmPassword:
|
| 171 |
};
|
| 172 |
|
| 173 |
ws.send(JSON.stringify({
|
|
@@ -222,7 +219,7 @@ export function RegisterPage() {
|
|
| 222 |
<div className="success-icon">โ
</div>
|
| 223 |
<h2>Registration Successful!</h2>
|
| 224 |
<p>{successMessage}</p>
|
| 225 |
-
<p className="success-subtitle">
|
| 226 |
<div className="success-animation">
|
| 227 |
<div className="confetti"></div>
|
| 228 |
</div>
|
|
@@ -284,61 +281,48 @@ export function RegisterPage() {
|
|
| 284 |
|
| 285 |
<div className="password-section">
|
| 286 |
<div className="section-header">
|
| 287 |
-
<h3>๐ Password
|
| 288 |
-
<label className="checkbox-label">
|
| 289 |
-
<input
|
| 290 |
-
type="checkbox"
|
| 291 |
-
checked={skipPassword}
|
| 292 |
-
onChange={(e) => setSkipPassword(e.target.checked)}
|
| 293 |
-
disabled={submitting}
|
| 294 |
-
/>
|
| 295 |
-
<span>Skip password</span>
|
| 296 |
-
</label>
|
| 297 |
</div>
|
| 298 |
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
<span>Set password & get bonus rewards!</span>
|
| 304 |
-
</div>
|
| 305 |
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
</>
|
| 341 |
-
)}
|
| 342 |
</div>
|
| 343 |
|
| 344 |
{errorMessage && (
|
|
@@ -365,10 +349,6 @@ export function RegisterPage() {
|
|
| 365 |
</>
|
| 366 |
)}
|
| 367 |
</button>
|
| 368 |
-
|
| 369 |
-
<p className="form-footer">
|
| 370 |
-
After submitting, verify in WhatsApp to activate your account.
|
| 371 |
-
</p>
|
| 372 |
</form>
|
| 373 |
</div>
|
| 374 |
</div>
|
|
|
|
| 18 |
const [sessionValid, setSessionValid] = useState<boolean | null>(null);
|
| 19 |
const [loading, setLoading] = useState(true);
|
| 20 |
const [submitting, setSubmitting] = useState(false);
|
|
|
|
| 21 |
|
| 22 |
const [formData, setFormData] = useState<RegistrationData>({
|
| 23 |
username: "",
|
|
|
|
| 131 |
newErrors.age = "Age must be between 13 and 100";
|
| 132 |
}
|
| 133 |
|
| 134 |
+
if (!formData.password) {
|
| 135 |
+
newErrors.password = "Password is required";
|
| 136 |
+
} else if (formData.password.length < 6 || formData.password.length > 20) {
|
| 137 |
+
newErrors.password = "Password must be 6-20 characters";
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
if (!formData.confirmPassword) {
|
| 141 |
+
newErrors.confirmPassword = "Please confirm your password";
|
| 142 |
+
} else if (formData.password !== formData.confirmPassword) {
|
| 143 |
+
newErrors.confirmPassword = "Passwords do not match";
|
|
|
|
|
|
|
| 144 |
}
|
| 145 |
|
| 146 |
setErrors(newErrors);
|
|
|
|
| 163 |
const submitData = {
|
| 164 |
username: formData.username.trim(),
|
| 165 |
age: parseInt(formData.age),
|
| 166 |
+
password: formData.password,
|
| 167 |
+
confirmPassword: formData.confirmPassword,
|
| 168 |
};
|
| 169 |
|
| 170 |
ws.send(JSON.stringify({
|
|
|
|
| 219 |
<div className="success-icon">โ
</div>
|
| 220 |
<h2>Registration Successful!</h2>
|
| 221 |
<p>{successMessage}</p>
|
| 222 |
+
<p className="success-subtitle">Your account has been activated automatically.</p>
|
| 223 |
<div className="success-animation">
|
| 224 |
<div className="confetti"></div>
|
| 225 |
</div>
|
|
|
|
| 281 |
|
| 282 |
<div className="password-section">
|
| 283 |
<div className="section-header">
|
| 284 |
+
<h3>๐ Password</h3>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
</div>
|
| 286 |
|
| 287 |
+
<div className="bonus-badge">
|
| 288 |
+
<span className="badge-icon">๐</span>
|
| 289 |
+
<span>Get bonus rewards with your account!</span>
|
| 290 |
+
</div>
|
|
|
|
|
|
|
| 291 |
|
| 292 |
+
<div className="rewards-list">
|
| 293 |
+
<div className="reward-item">๐ +100 Limit</div>
|
| 294 |
+
<div className="reward-item">๐ช +10,000 Money</div>
|
| 295 |
+
<div className="reward-item">โญ +50 EXP</div>
|
| 296 |
+
<div className="reward-item">๐ฎ RPG Access</div>
|
| 297 |
+
</div>
|
| 298 |
|
| 299 |
+
<div className="form-group">
|
| 300 |
+
<label htmlFor="password">Password</label>
|
| 301 |
+
<input
|
| 302 |
+
type="password"
|
| 303 |
+
id="password"
|
| 304 |
+
value={formData.password}
|
| 305 |
+
onChange={(e) => handleInputChange("password", e.target.value)}
|
| 306 |
+
placeholder="6-20 characters"
|
| 307 |
+
className={errors.password ? "error" : ""}
|
| 308 |
+
disabled={submitting}
|
| 309 |
+
/>
|
| 310 |
+
{errors.password && <span className="error-text">{errors.password}</span>}
|
| 311 |
+
</div>
|
| 312 |
|
| 313 |
+
<div className="form-group">
|
| 314 |
+
<label htmlFor="confirmPassword">Confirm Password</label>
|
| 315 |
+
<input
|
| 316 |
+
type="password"
|
| 317 |
+
id="confirmPassword"
|
| 318 |
+
value={formData.confirmPassword}
|
| 319 |
+
onChange={(e) => handleInputChange("confirmPassword", e.target.value)}
|
| 320 |
+
placeholder="Re-enter password"
|
| 321 |
+
className={errors.confirmPassword ? "error" : ""}
|
| 322 |
+
disabled={submitting}
|
| 323 |
+
/>
|
| 324 |
+
{errors.confirmPassword && <span className="error-text">{errors.confirmPassword}</span>}
|
| 325 |
+
</div>
|
|
|
|
|
|
|
| 326 |
</div>
|
| 327 |
|
| 328 |
{errorMessage && (
|
|
|
|
| 349 |
</>
|
| 350 |
)}
|
| 351 |
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 352 |
</form>
|
| 353 |
</div>
|
| 354 |
</div>
|