From 7dfbe0f363a434cfda5f9be996d194f03c36879c Mon Sep 17 00:00:00 2001
From: Biswakalyan Bhuyan <biswa@surgot.in>
Date: Wed, 31 Jul 2024 12:16:49 +0530
Subject: new project

---
 panel/src/pages/RegisterPage.jsx | 47 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 panel/src/pages/RegisterPage.jsx

(limited to 'panel/src/pages/RegisterPage.jsx')

diff --git a/panel/src/pages/RegisterPage.jsx b/panel/src/pages/RegisterPage.jsx
new file mode 100644
index 0000000..f0b2bba
--- /dev/null
+++ b/panel/src/pages/RegisterPage.jsx
@@ -0,0 +1,47 @@
+import React, { useState } from 'react';
+import { TextField, Button, Container, Typography } from '@mui/material';
+import { createUserWithEmailAndPassword } from 'firebase/auth';
+import { auth } from '../firebase';
+
+const RegisterPage = () => {
+  const [email, setEmail] = useState('');
+  const [password, setPassword] = useState('');
+  const [error, setError] = useState('');
+
+  const handleRegister = async () => {
+    if (password.length < 8) {
+      setError('The password should be minimum 8 digits');
+      return;
+    }
+
+    try {
+      await createUserWithEmailAndPassword(auth, email, password);
+    } catch (error) {
+      setError(error.message);
+    }
+  };
+
+  return (
+    <Container>
+      <Typography variant="h4">Register</Typography>
+      <TextField
+        label="Email"
+        type="email"
+        value={email}
+        onChange={(e) => setEmail(e.target.value)}
+        fullWidth
+      />
+      <TextField
+        label="Password"
+        type="password"
+        value={password}
+        onChange={(e) => setPassword(e.target.value)}
+        fullWidth
+      />
+      {error && <Typography color="error">{error}</Typography>}
+      <Button onClick={handleRegister} variant="contained">Register</Button>
+    </Container>
+  );
+};
+
+export default RegisterPage;
-- 
cgit v1.2.3-59-g8ed1b

