smartstudy-buddyhub / components /register-form.js
itamarlifshitz's picture
ืฉื™ืฉ ืื•ืคืฆื™ื” ืฉืœ ืžื‘ื—ืŸ / ืขื‘ื•ื“ื” ื—ื“ืฉื” ื•ืื– ืจืง ืืคืฉืจ ืœื”ืขืœื•ืช ืงื‘ืฆื™ื ื•ื–ื” ืžืกื“ืจ ืœืš ืืช ื–ื” ืœืคื™ ืื™ืš ืฉืงืจืืช ืœืขื‘ื•ื“ื” ืื—ืจื™ ืฉื”ืขืœืช ืืช ื”ืงื‘ืฆื™ื ืืชื” ื‘ื•ื—ืจ ืžื” ื‘ื ืœืš ืฉื”ื•ื ื™ืขืฉื” (ื›ืจื˜ื™ืกื™ื•ืช ืขื ืฉืืœื•ืช/ืžื‘ื—ื ื™ื/ืกื™ื›ื•ืžื™ื ื•ืขื•ื“) ื ื•ืกืฃ ืขืœ ื›ืš ืชืขืฉื” ืฉืœืื ื™ ืฉืืคืฉืจ ืœืขืฉื•ืช ืžืฉื”ื• ืฆืจื™ืš ืœื”ื™ืจืฉื ื•ืœืจืฉื•ื ืืช ื”ืžื™ื™ืœ ื•ื›ืœ ืคืขื ืฉืžื™ืฉื”ื• ื ืจืฉื ื”ื•ื ืžืงื‘ืœ ืœืžื™ื™ืœ ื”ื•ื“ืขื” ( ื‘ืจื•ืš ื”ื‘ื ืœstudy mate ื‘ื ื•ืกืฃ ืชื•ืจื™ื“ ืืช ื”ืชืžื•ื ื” ืฉืฉืžืช ื•ืชืขืฆื‘ ืืช ื”ืืชืจ ืฉื™ื”ื™ื” ืžืžืฉ ืžื•ืฉืงืข ืื‘ืœ ืฆื‘ืขื™ื ืจื’ื•ืขื™ื
6110ac3 verified
raw
history blame
3.46 kB
class RegisterForm extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
.register-form {
max-width: 500px;
margin: 0 auto;
padding: 2rem;
background: var(--card-bg);
border-radius: 16px;
box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.form-group {
margin-bottom: 1.5rem;
}
label {
display: block;
margin-bottom: 0.5rem;
font-weight: 600;
}
input {
width: 100%;
padding: 12px;
border: 1px solid #ddd;
border-radius: 8px;
font-family: inherit;
}
.btn {
width: 100%;
padding: 12px;
border-radius: 8px;
border: none;
font-weight: bold;
cursor: pointer;
background: var(--primary);
color: white;
transition: background 0.3s;
}
.btn:hover {
background: var(--primary-light);
}
.login-link {
text-align: center;
margin-top: 1rem;
}
.login-link a {
color: var(--primary);
text-decoration: none;
}
</style>
<div class="register-form">
<h2>ื”ืจืฉืžื”</h2>
<form id="registerForm">
<div class="form-group">
<label for="name">ืฉื ืžืœื</label>
<input type="text" id="name" required>
</div>
<div class="form-group">
<label for="email">ืื™ืžื™ื™ืœ</label>
<input type="email" id="email" required>
</div>
<div class="form-group">
<label for="password">ืกื™ืกืžื”</label>
<input type="password" id="password" required>
</div>
<div class="form-group">
<label for="confirm-password">ืื™ืžื•ืช ืกื™ืกืžื”</label>
<input type="password" id="confirm-password" required>
</div>
<button type="submit" class="btn">ื”ืจืฉื</button>
</form>
<div class="login-link">
ื›ื‘ืจ ื™ืฉ ืœืš ื—ืฉื‘ื•ืŸ? <a href="/login.html">ื”ืชื—ื‘ืจ ื›ืืŸ</a>
</div>
</div>
`;
this.shadowRoot.getElementById('registerForm').addEventListener('submit', async (e) => {
e.preventDefault();
const email = this.shadowRoot.getElementById('email').value;
const password = this.shadowRoot.getElementById('password').value;
// Send welcome email
await fetch('https://api.emailjs.com/api/v1.0/email/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
service_id: 'YOUR_SERVICE_ID',
template_id: 'YOUR_TEMPLATE_ID',
user_id: 'YOUR_USER_ID',
template_params: {
to_email: email,
subject: 'ื‘ืจื•ืš ื”ื‘ื ืœ-StudyMate!',
message: 'ืชื•ื“ื” ืฉื ืจืฉืžืช ืœ-StudyMate! ืื ื• ืฉืžื—ื™ื ืœื”ืฆื˜ืจืคื•ืชืš ืœืžืขืจื›ืช.'
}
})
});
// Register user (simplified)
alert('ื”ื”ืจืฉืžื” ื‘ื•ืฆืขื” ื‘ื”ืฆืœื—ื”! ื ื ืœื‘ื“ื•ืง ืืช ื”ืื™ืžื™ื™ืœ ืฉืœืš ืœื”ื•ื“ืขืช ื‘ืจื•ืš ื”ื‘ื.');
});
}
}
customElements.define('register-form', RegisterForm);