@@ -2,26 +2,21 @@ import React, { useState } from "react";
22import { auth , db } from "../firebase" ;
33import { Form , Button } from "react-bootstrap" ;
44import "./Welcome.css" ;
5- function Signup ( ) {
6- const [ name , setName ] = useState ( null ) ;
7- const [ InsId , setInsId ] = useState ( null ) ;
8- const [ email , setEmail ] = useState ( null ) ;
9- const [ password , setPassword ] = useState ( null ) ;
105
6+ function EmailAuth ( ) {
7+ const [ email , setEmail ] = useState ( null ) ;
118 const handleSubmit = async ( e ) => {
129 e . preventDefault ( ) ;
13- if ( name && email && password && InsId ) {
10+ if ( email ) {
1411 await auth
15- . createUserWithEmailAndPassword ( email , password )
12+ . createUserWithEmailAndPassword ( email )
1613 . then ( async ( authUser ) => {
1714 if ( authUser ) {
1815 const uid = authUser ?. user ?. uid ;
1916
2017 db . collection ( "users" ) . doc ( uid ) . set ( {
21- name : name ,
2218 finishedSetup : false ,
2319 features : null , // means get the institute id and face features of the student
24- collegeId : InsId ,
2520 } ) ;
2621 }
2722 } )
@@ -36,77 +31,38 @@ function Signup() {
3631 className = "container mt-4"
3732 style = { { width : "70%" , padding : "10%" } }
3833 >
39- < div className = "form" >
40- < h2
41- style = { {
42- color : "grey" ,
43- textAlign : "center" ,
44- textDecoration : "bold" ,
45- } }
46- >
47- Welcome to The Attendlt!
48- </ h2 >
49- < h3
50- style = { {
51- color : "#ff3300" ,
52- textAlign : "center" ,
53- textDecoration : "bold" ,
54- } }
55- >
56- You need to fill the following details to register!
57- </ h3 >
58- < Form onSubmit = { handleSubmit } className = "form" >
59- < Form . Group >
60- < Form . Label > Name</ Form . Label >
61- < Form . Control
62- type = "text"
63- placeholder = "Enter your name"
64- value = { name }
65- onChange = { ( e ) => setName ( e . target . value ) }
66- />
67- </ Form . Group >
34+ < h2 > Welcome to The Attendlt!</ h2 >
35+ < h3
36+ style = { {
37+ color : "#ff3300" ,
38+ textAlign : "center" ,
39+ textDecoration : "bold" ,
40+ } }
41+ >
42+ You need to verify your email first to register!
43+ </ h3 >
44+ < Form onSubmit = { handleSubmit } className = "form" >
45+ < Form . Group >
46+ < Form . Label > Email address</ Form . Label >
47+ < Form . Control
48+ type = "email"
49+ placeholder = "Enter email"
50+ value = { email }
51+ onChange = { ( e ) => setEmail ( e . target . value ) }
52+ />
53+ </ Form . Group >
6854
69- < Form . Group >
70- < Form . Label > Institute ID</ Form . Label >
71- < Form . Control
72- type = "text"
73- placeholder = "Enter InstituteID"
74- value = { InsId }
75- onChange = { ( e ) => setInsId ( e . target . value ) }
76- />
77- </ Form . Group >
78-
79- < Form . Group >
80- < Form . Label > Email address</ Form . Label >
81- < Form . Control
82- type = "email"
83- placeholder = "Enter email"
84- value = { email }
85- onChange = { ( e ) => setEmail ( e . target . value ) }
86- />
87- </ Form . Group >
88-
89- < Form . Group >
90- < Form . Label > Password</ Form . Label >
91- < Form . Control
92- type = "password"
93- placeholder = "Password"
94- value = { password }
95- onChange = { ( e ) => setPassword ( e . target . value ) }
96- />
97- </ Form . Group >
98- < Button
99- type = "submit"
100- style = { { width : "45%" , background : "#ff3300" } }
101- >
102- Register
103- </ Button >
104- </ Form >
105- </ div >
55+ < Button
56+ type = "submit"
57+ style = { { width : "45%" , background : "#ff3300" } }
58+ >
59+ Verify
60+ </ Button >
61+ </ Form >
10662 </ div >
10763 </ div >
10864 </ >
10965 ) ;
11066}
11167
112- export default Signup ;
68+ export default EmailAuth ;
0 commit comments