class RegisterForm extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
`;
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);