Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-049
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-049
2021-049
Commits
b8298554
Commit
b8298554
authored
Aug 21, 2021
by
Hasitha Samarasekara
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'IT18063288' into 'master'
All sign up created See merge request
!8
parents
ae8ae3e9
a0272770
Changes
26
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
1123 additions
and
192 deletions
+1123
-192
BackEnd/WebBackEnd/.env
BackEnd/WebBackEnd/.env
+3
-1
BackEnd/WebBackEnd/email-config/config.js
BackEnd/WebBackEnd/email-config/config.js
+4
-0
BackEnd/WebBackEnd/email/email.controller.js
BackEnd/WebBackEnd/email/email.controller.js
+66
-0
BackEnd/WebBackEnd/email/email.msgs.js
BackEnd/WebBackEnd/email/email.msgs.js
+7
-0
BackEnd/WebBackEnd/email/email.send.js
BackEnd/WebBackEnd/email/email.send.js
+45
-0
BackEnd/WebBackEnd/email/email.templates.js
BackEnd/WebBackEnd/email/email.templates.js
+20
-0
BackEnd/WebBackEnd/models/institute.user.model.js
BackEnd/WebBackEnd/models/institute.user.model.js
+1
-1
BackEnd/WebBackEnd/models/tutor.user.model.js
BackEnd/WebBackEnd/models/tutor.user.model.js
+5
-3
BackEnd/WebBackEnd/models/userAccount.user.model.js
BackEnd/WebBackEnd/models/userAccount.user.model.js
+20
-0
BackEnd/WebBackEnd/package-lock.json
BackEnd/WebBackEnd/package-lock.json
+6
-0
BackEnd/WebBackEnd/package.json
BackEnd/WebBackEnd/package.json
+3
-0
BackEnd/WebBackEnd/routes/institute.route.js
BackEnd/WebBackEnd/routes/institute.route.js
+112
-16
BackEnd/WebBackEnd/routes/student.route.js
BackEnd/WebBackEnd/routes/student.route.js
+157
-29
BackEnd/WebBackEnd/routes/tutor.route.js
BackEnd/WebBackEnd/routes/tutor.route.js
+152
-25
BackEnd/WebBackEnd/routes/userAccount.route.js
BackEnd/WebBackEnd/routes/userAccount.route.js
+37
-0
BackEnd/WebBackEnd/server.js
BackEnd/WebBackEnd/server.js
+2
-0
WebFrontEnd/smartcoach-frontend/package-lock.json
WebFrontEnd/smartcoach-frontend/package-lock.json
+10
-0
WebFrontEnd/smartcoach-frontend/package.json
WebFrontEnd/smartcoach-frontend/package.json
+2
-1
WebFrontEnd/smartcoach-frontend/src/App.js
WebFrontEnd/smartcoach-frontend/src/App.js
+4
-0
WebFrontEnd/smartcoach-frontend/src/Components/AccountVerified.js
...End/smartcoach-frontend/src/Components/AccountVerified.js
+64
-0
WebFrontEnd/smartcoach-frontend/src/Components/Home.js
WebFrontEnd/smartcoach-frontend/src/Components/Home.js
+9
-0
WebFrontEnd/smartcoach-frontend/src/Components/Login.js
WebFrontEnd/smartcoach-frontend/src/Components/Login.js
+84
-69
WebFrontEnd/smartcoach-frontend/src/Components/SignUp.js
WebFrontEnd/smartcoach-frontend/src/Components/SignUp.js
+213
-47
WebFrontEnd/smartcoach-frontend/src/Components/beforeConfirmation.js
.../smartcoach-frontend/src/Components/beforeConfirmation.js
+97
-0
WebFrontEnd/smartcoach-frontend/src/Images/confirmemail.png
WebFrontEnd/smartcoach-frontend/src/Images/confirmemail.png
+0
-0
WebFrontEnd/smartcoach-frontend/src/Images/verified.png
WebFrontEnd/smartcoach-frontend/src/Images/verified.png
+0
-0
No files found.
BackEnd/WebBackEnd/.env
View file @
b8298554
ATLAS_URI = mongodb+srv://admin:admin@cluster0.wmb3b.mongodb.net/SmartCoach?retryWrites=true&w=majority
\ No newline at end of file
ATLAS_URI = mongodb+srv://admin:admin@cluster0.wmb3b.mongodb.net/SmartCoach?retryWrites=true&w=majority
MAIL_USER=onlineshoppingwebsite18@gmail.com
MAIL_PASS=Sliit@123
\ No newline at end of file
BackEnd/WebBackEnd/email-config/config.js
0 → 100644
View file @
b8298554
module
.
exports
=
{
USER
:
'
smartcoach.smteam@gmail.com
'
,
PASS
:
'
Sliit@123
'
}
BackEnd/WebBackEnd/email/email.controller.js
0 → 100644
View file @
b8298554
const
User
=
require
(
'
../models/userAccount.user.model
'
);
const
sendEmail
=
require
(
'
./email.send
'
);
const
msgs
=
require
(
'
./email.msgs
'
);
const
templates
=
require
(
'
./email.templates
'
);
exports
.
collectEmail
=
(
req
,
res
)
=>
{
const
{
email
}
=
req
.
body
User
.
findOne
({
email
})
.
then
(
user
=>
{
// We have a new user! Send them a confirmation email.
if
(
!
user
)
{
User
.
create
({
email
})
.
then
(
newUser
=>
sendEmail
(
newUser
.
email
,
templates
.
confirm
(
newUser
.
_id
)))
.
then
(()
=>
res
.
json
({
msg
:
msgs
.
confirm
}))
.
catch
(
err
=>
console
.
log
(
err
))
}
// We have already seen this email address. But the user has not
// clicked on the confirmation link. Send another confirmation email.
else
if
(
user
&&
!
user
.
confirmed
)
{
sendEmail
(
user
.
email
,
templates
.
confirm
(
user
.
_id
))
.
then
(()
=>
res
.
json
({
msg
:
msgs
.
resend
}))
}
// The user has already confirmed this email address
else
{
res
.
json
({
msg
:
msgs
.
alreadyConfirmed
})
}
})
.
catch
(
err
=>
console
.
log
(
err
))
}
// The callback that is invoked when the user visits the confirmation
// url on the client and a fetch request is sent in componentDidMount.
exports
.
confirmEmail
=
(
req
,
res
)
=>
{
const
{
id
}
=
req
.
params
User
.
findById
(
id
)
.
then
(
user
=>
{
// A user with that id does not exist in the DB. Perhaps some tricky
// user tried to go to a different url than the one provided in the
// confirmation email.
if
(
!
user
)
{
res
.
json
({
msg
:
msgs
.
couldNotFind
})
}
// The user exists but has not been confirmed. We need to confirm this
// user and let them know their email address has been confirmed.
else
if
(
user
&&
!
user
.
confirmed
)
{
User
.
findByIdAndUpdate
(
id
,
{
confirmed
:
true
})
.
then
(()
=>
res
.
json
({
msg
:
msgs
.
confirmed
}))
.
catch
(
err
=>
console
.
log
(
err
))
}
// The user has already confirmed this email address.
else
{
res
.
json
({
msg
:
msgs
.
alreadyConfirmed
})
}
})
.
catch
(
err
=>
console
.
log
(
err
))
}
\ No newline at end of file
BackEnd/WebBackEnd/email/email.msgs.js
0 → 100644
View file @
b8298554
module
.
exports
=
{
confirm
:
'
Email sent, please check your inbox to confirm
'
,
confirmed
:
'
Your email is confirmed!
'
,
resend
:
'
Confirmation email resent, maybe check your spam?
'
,
couldNotFind
:
'
Could not find you!
'
,
alreadyConfirmed
:
'
Your email was already confirmed
'
}
\ No newline at end of file
BackEnd/WebBackEnd/email/email.send.js
0 → 100644
View file @
b8298554
const
nodemailer
=
require
(
'
nodemailer
'
)
// The credentials for the email account you want to send mail from.
const
credentials
=
{
host
:
'
smtp.gmail.com
'
,
port
:
465
,
secure
:
true
,
auth
:
{
// These environment variables will be pulled from the .env file
user
:
process
.
env
.
MAIL_USER
,
pass
:
process
.
env
.
MAIL_PASS
}
}
// Getting Nodemailer all setup with the credentials for when the 'sendEmail()'
// function is called.
const
transporter
=
nodemailer
.
createTransport
(
credentials
)
// exporting an 'async' function here allows 'await' to be used
// as the return value of this function.
module
.
exports
=
async
(
to
,
content
)
=>
{
// The from and to addresses for the email that is about to be sent.
const
contacts
=
{
from
:
process
.
env
.
MAIL_USER
,
to
}
// Combining the content and contacts into a single object that can
// be passed to Nodemailer.
const
email
=
Object
.
assign
({},
content
,
contacts
)
// This file is imported into the controller as 'sendEmail'. Because
// 'transporter.sendMail()' below returns a promise we can write code like this
// in the contoller when we are using the sendEmail() function.
//
// sendEmail()
// .then(() => doSomethingElse())
//
// If you are running into errors getting Nodemailer working, wrap the following
// line in a try/catch. Most likely is not loading the credentials properly in
// the .env file or failing to allow unsafe apps in your gmail settings.
await
transporter
.
sendMail
(
email
)
}
\ No newline at end of file
BackEnd/WebBackEnd/email/email.templates.js
0 → 100644
View file @
b8298554
const
{
CLIENT_ORIGIN
}
=
'
http://localhost:3000/beforeConfirm
'
// This file is exporting an Object with a single key/value pair.
// However, because this is not a part of the logic of the application
// it makes sense to abstract it to another file. Plus, it is now easily
// extensible if the application needs to send different email templates
// (eg. unsubscribe) in the future.
module
.
exports
=
{
confirm
:
id
=>
({
subject
:
'
React Confirm Email
'
,
html
:
`
<a href='
${
CLIENT_ORIGIN
}
/confirm/
${
id
}
'>
click to confirm email
</a>
`
,
text
:
`Copy and paste this link:
${
CLIENT_ORIGIN
}
/confirm/
${
id
}
`
})
}
\ No newline at end of file
BackEnd/WebBackEnd/models/institute.user.model.js
View file @
b8298554
...
...
@@ -5,7 +5,7 @@ const Schema = mongoose.Schema;
const
userSchema
=
new
Schema
({
institute_name
:{
type
:
String
,
required
:
true
},
institute_email
:
{
type
:
String
,
required
:
true
},
institute_phones
:
{
type
:
String
,
required
:
true
}
,
institute_phones
:
[{
type
:
String
,
required
:
true
}]
,
institute_address
:{
type
:
String
,
required
:
true
},
institute_city
:{
type
:
String
,
required
:
true
},
institute_password
:{
type
:
String
,
required
:
true
},
...
...
BackEnd/WebBackEnd/models/tutor.user.model.js
View file @
b8298554
...
...
@@ -13,12 +13,14 @@ const userSchema = new Schema({
tutor_status
:{
type
:
String
},
tutor_image
:{
type
:
String
},
tutor_Stream
:{
type
:
String
},
tutor_subjects
:{
type
:
String
},
tutor_class_types
:{
type
:
String
},
tutor_subjects
:[{
type
:
String
}],
isOnlineClass
:{
type
:
Boolean
},
isHomeVisit
:{
type
:
Boolean
},
isInstitute
:{
type
:
Boolean
},
tutor_main_district
:{
type
:
String
},
tutor_main_city
:{
type
:
String
},
tutor_medium
:{
type
:
String
},
tutor_instituteID
:{
type
:
String
}
,
tutor_instituteID
List
:[{
type
:
String
}]
,
},
{
timestamps
:
true
,
});
...
...
BackEnd/WebBackEnd/models/userAccount.user.model.js
0 → 100644
View file @
b8298554
const
mongoose
=
require
(
'
mongoose
'
);
const
Schema
=
mongoose
.
Schema
;
const
userSchema
=
new
Schema
({
user_id
:{
type
:
String
,
required
:
true
},
user_nic
:{
type
:
String
,
required
:
false
},
user_email
:
{
type
:
String
,
required
:
true
},
user_password
:{
type
:
String
,
required
:
true
},
user_type
:{
type
:
String
,
required
:
true
},
confirmed
:
{
type
:
Boolean
,
default
:
true
}
});
const
UserAccount
=
mongoose
.
model
(
'
UserAccount
'
,
userSchema
);
module
.
exports
=
UserAccount
;
\ No newline at end of file
BackEnd/WebBackEnd/package-lock.json
View file @
b8298554
...
...
@@ -392,6 +392,12 @@
"resolved"
:
"https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz"
,
"integrity"
:
"sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
},
"nodemailer"
:
{
"version"
:
"6.6.2"
,
"resolved"
:
"https://registry.npmjs.org/nodemailer/-/nodemailer-6.6.2.tgz"
,
"integrity"
:
"sha512-YSzu7TLbI+bsjCis/TZlAXBoM4y93HhlIgo0P5oiA2ua9Z4k+E2Fod//ybIzdJxOlXGRcHIh/WaeCBehvxZb/Q=="
,
"dev"
:
true
},
"object-assign"
:
{
"version"
:
"4.1.1"
,
"resolved"
:
"https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz"
,
...
...
BackEnd/WebBackEnd/package.json
View file @
b8298554
...
...
@@ -14,5 +14,8 @@
"dotenv"
:
"^10.0.0"
,
"express"
:
"^4.17.1"
,
"mongoose"
:
"^5.12.15"
},
"devDependencies"
:
{
"nodemailer"
:
"^6.6.2"
}
}
BackEnd/WebBackEnd/routes/institute.route.js
View file @
b8298554
const
router
=
require
(
'
express
'
).
Router
();
let
institute
=
require
(
'
../models/institute.user.model
'
);
let
userAccount
=
require
(
'
../models/userAccount.user.model
'
);
const
nodemailer
=
require
(
'
nodemailer
'
);
const
cred
=
require
(
'
../email-config/config
'
);
////////////////////////////////////////////////////////////////////////////////////////
var
transport
=
{
host
:
'
smtp.gmail.com
'
,
auth
:
{
user
:
cred
.
USER
,
pass
:
cred
.
PASS
}
}
var
transporter
=
nodemailer
.
createTransport
(
transport
);
transporter
.
verify
((
error
,
success
)
=>
{
if
(
error
)
{
console
.
log
(
error
);
}
else
{
console
.
log
(
'
Server is ready to take messages of Institute
'
);
}
});
/////////////////////////////////////////////////////////////////////////////////////////////
router
.
route
(
'
/
'
).
get
((
req
,
res
)
=>
{
institute
.
find
()
.
then
(
students
=>
res
.
json
(
student
s
))
.
then
(
Institutes
=>
res
.
json
(
Institute
s
))
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Eroor:
'
+
err
));
});
router
.
route
(
'
/add
'
).
post
((
req
,
res
)
=>
{
router
.
route
(
'
/add
'
).
post
(
async
(
req
,
res
)
=>
{
const
institute_name
=
req
.
body
.
institute_name
;
const
institute_email
=
req
.
body
.
institute_email
;
const
institute_phones
=
req
.
body
.
institute_phones
;
...
...
@@ -18,20 +46,88 @@ router.route('/add').post((req,res) =>{
const
institute_image
=
req
.
body
.
institute_image
;
const
newInstitute
=
new
institute
({
institute_name
,
institute_email
,
institute_phones
,
institute_address
,
institute_city
,
institute_password
,
institute_registrationNo
,
institute_image
});
newInstitute
.
save
()
.
then
(()
=>
res
.
json
(
'
Institute Successfully Added....
'
))
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Error:
'
+
err
));
//checking if the user is already exist in the database
const
user
=
await
institute
.
findOne
({
institute_email
:
req
.
body
.
institute_email
})
if
(
!
user
){
const
newInstitute
=
new
institute
({
institute_name
,
institute_email
,
institute_phones
,
institute_address
,
institute_city
,
institute_password
,
institute_registrationNo
,
institute_image
});
newInstitute
.
save
()
.
then
(
Institute
=>
{
const
user_id
=
Institute
.
id
.
toString
();
const
user_nic
=
""
;
const
user_email
=
req
.
body
.
institute_email
;
const
user_password
=
req
.
body
.
institute_password
;
const
user_type
=
"
Institute
"
;
const
newUser
=
new
userAccount
({
user_id
,
user_nic
,
user_email
,
user_password
,
user_type
});
newUser
.
save
()
.
then
(
newUser
=>
{
////////////////////////////////////////////////////////////////////////////////////
// const content = `
// Hi ${institute_name},\n
// You are Create a Institute Account on SmartCoach.\n
// You can verify your email address click on 'http://localhost:3000/AccountVerified/${newUser.id}'
//
// Used institute email address as the username : ${user_email}
// Used given password as the password
// Thank You,
// Team SmartCoach
// `;
//
// var mail = {
// from: institute_name,
// to: user_email,
// subject: 'Email Verification - Institute',
// text: content
// }
//
// transporter.sendMail(mail, (err, data) => {
// if (err) {
// res.json({
// msg: 'fail'
// })
// } else {
// res.json({
// msg: 'success'
// })
// }
// })
// ;
/////////////////////////////////////////////////////////////////////////////////////
})
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Error:
'
+
err
));
})
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Error:
'
+
err
));
}
else
{
return
res
.
status
(
500
).
json
(
'
Email already exit
'
);
}
});
...
...
BackEnd/WebBackEnd/routes/student.route.js
View file @
b8298554
const
router
=
require
(
'
express
'
).
Router
();
let
student
=
require
(
'
../models/student.user.model
'
);
let
userAccount
=
require
(
'
../models/userAccount.user.model
'
);
const
nodemailer
=
require
(
'
nodemailer
'
);
const
cred
=
require
(
'
../email-config/config
'
);
////////////////////////////////////////////////////////////////////////////////////////
var
transport
=
{
host
:
'
smtp.gmail.com
'
,
auth
:
{
user
:
cred
.
USER
,
pass
:
cred
.
PASS
}
}
var
transporter
=
nodemailer
.
createTransport
(
transport
);
transporter
.
verify
((
error
,
success
)
=>
{
if
(
error
)
{
console
.
log
(
error
);
}
else
{
console
.
log
(
'
Server is ready to take messages to Student
'
);
}
});
/////////////////////////////////////////////////////////////////////////////////////////////
router
.
route
(
'
/
'
).
get
((
req
,
res
)
=>
{
student
.
find
()
...
...
@@ -7,35 +31,139 @@ router.route('/').get((req,res) =>{
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Eroor:
'
+
err
));
});
router
.
route
(
'
/add
'
).
post
((
req
,
res
)
=>
{
const
student_name
=
req
.
body
.
student_name
;
const
student_nic
=
req
.
body
.
student_nic
;
const
student_email
=
req
.
body
.
student_email
;
const
student_phone
=
req
.
body
.
student_phone
;
const
student_address
=
req
.
body
.
student_address
;
const
student_password
=
req
.
body
.
student_password
;
const
student_gender
=
req
.
body
.
student_gender
;
const
student_image
=
req
.
body
.
student_image
;
const
guardian_name
=
req
.
body
.
guardian_name
;
const
guardian_email
=
req
.
body
.
guardian_email
;
const
guardian_relationship
=
req
.
body
.
guardian_relationship
;
const
newStudent
=
new
student
({
student_name
,
student_nic
,
student_email
,
student_phone
,
student_address
,
student_password
,
student_gender
,
student_image
,
guardian_name
,
guardian_email
,
guardian_relationship
});
newStudent
.
save
()
.
then
(()
=>
res
.
json
(
'
Student Successfully Added....
'
))
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Error:
'
+
err
));
router
.
route
(
'
/add
'
).
post
(
async
(
req
,
res
)
=>
{
//checking if the user is already exist in the database
const
user
=
await
student
.
findOne
({
student_email
:
req
.
body
.
student_email
})
if
(
!
user
){
const
student_name
=
req
.
body
.
student_name
;
const
student_nic
=
req
.
body
.
student_nic
;
const
student_email
=
req
.
body
.
student_email
;
const
student_phone
=
req
.
body
.
student_phone
;
const
student_address
=
req
.
body
.
student_address
;
const
student_password
=
req
.
body
.
student_password
;
const
student_gender
=
req
.
body
.
student_gender
;
const
student_image
=
req
.
body
.
student_image
;
const
guardian_name
=
req
.
body
.
guardian_name
;
const
guardian_email
=
req
.
body
.
guardian_email
;
const
guardian_relationship
=
req
.
body
.
guardian_relationship
;
const
newStudent
=
new
student
({
student_name
,
student_nic
,
student_email
,
student_phone
,
student_address
,
student_password
,
student_gender
,
student_image
,
guardian_name
,
guardian_email
,
guardian_relationship
});
newStudent
.
save
()
.
then
(
Student
=>
{
const
user_id
=
Student
.
id
.
toString
();
const
user_nic
=
student_nic
;
const
user_email
=
student_email
;
const
user_password
=
student_password
;
const
user_type
=
"
Student
"
;
const
newUser
=
new
userAccount
({
user_id
,
user_nic
,
user_email
,
user_password
,
user_type
});
newUser
.
save
()
.
then
(
newUser
=>
{
////////////////////////////////////////////////////////////////////////////////////
// const content = `
// Hi ${student_name},\n
// You are Create a Student Account on SmartCoach.\n
// You can verify your email address click on 'http://localhost:3000/AccountVerified/${newUser.id}'
//
// Used your email address as the username : ${user_email}
// Used given password as the password
// Thank You,
// Team SmartCoach
// `;
//
// var mail = {
// from: student_name,
// to: user_email,
// subject: 'Email Verification - Student',
// text: content
// }
//
// transporter.sendMail(mail, (err, data) => {
// if (err) {
// res.json({
// msg: 'fail'
// })
// } else {
// res.json({
// msg: 'success'
// })
// }
// })
// ;
//
//
// const content_guardian = `
// Hi ${guardian_name},\n
// Your student ${student_name} is Create a Student Account on SmartCoach.\n
//
// You can know student progress through the email.
// We will send Student attendance, Quiz marks, Assignment Marks and other details through this email.
//
// Thank You,
// Team SmartCoach
// `;
//
// var mail_guardian = {
// from: guardian_name,
// to: guardian_email,
// subject: 'Student Information on SmartCoach',
// text: content_guardian
// }
//
// transporter.sendMail(mail_guardian, (err, data) => {
// if (err) {
// res.json({
// msg: 'fail'
// })
// } else {
// res.json({
// msg: 'success'
// })
// }
// })
// ;
/////////////////////////////////////////////////////////////////////////////////////
})
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Error:
'
+
err
));
})
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Error:
'
+
err
));
}
else
{
return
res
.
status
(
500
).
json
(
'
Email already exit
'
);
}
});
...
...
BackEnd/WebBackEnd/routes/tutor.route.js
View file @
b8298554
const
router
=
require
(
'
express
'
).
Router
();
let
tutor
=
require
(
'
../models/tutor.user.model
'
);
let
userAccount
=
require
(
'
../models/userAccount.user.model
'
);
const
nodemailer
=
require
(
'
nodemailer
'
);
const
cred
=
require
(
'
../email-config/config
'
);
////////////////////////////////////////////////////////////////////////////////////////
var
transport
=
{
host
:
'
smtp.gmail.com
'
,
auth
:
{
user
:
cred
.
USER
,
pass
:
cred
.
PASS
}
}
var
transporter
=
nodemailer
.
createTransport
(
transport
);
transporter
.
verify
((
error
,
success
)
=>
{
if
(
error
)
{
console
.
log
(
error
);
}
else
{
console
.
log
(
'
Server is ready to take messages of User
'
);
}
});
/////////////////////////////////////////////////////////////////////////////////////////////
router
.
route
(
'
/
'
).
get
((
req
,
res
)
=>
{
tutor
.
find
()
...
...
@@ -7,7 +33,9 @@ router.route('/').get((req,res) =>{
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Eroor:
'
+
err
));
});
router
.
route
(
'
/add
'
).
post
((
req
,
res
)
=>
{
router
.
route
(
'
/add
'
).
post
(
async
(
req
,
res
)
=>
{
console
.
log
(
"
Tutor Registration began
"
)
const
tutor_name
=
req
.
body
.
tutor_name
;
const
tutor_nic
=
req
.
body
.
tutor_nic
;
const
tutor_email
=
req
.
body
.
tutor_email
;
...
...
@@ -19,35 +47,134 @@ router.route('/add').post((req,res) =>{
const
tutor_image
=
req
.
body
.
tutor_image
;
const
tutor_Stream
=
req
.
body
.
tutor_Stream
;
const
tutor_subjects
=
req
.
body
.
tutor_subjects
;
const
tutor_class_types
=
req
.
body
.
tutor_class_types
;
const
isOnlineClass
=
req
.
body
.
isOnlineClass
;
const
isHomeVisit
=
req
.
body
.
isHomeVisit
;
const
isInstitute
=
req
.
body
.
isInstitute
;
const
tutor_main_district
=
req
.
body
.
tutor_main_district
;
const
tutor_main_city
=
req
.
body
.
tutor_main_city
;
const
tutor_medium
=
req
.
body
.
tutor_medium
;
const
tutor_instituteID
=
req
.
body
.
tutor_instituteID
;
const
newTutor
=
new
tutor
({
tutor_name
,
tutor_nic
,
tutor_email
,
tutor_phone
,
tutor_address
,
tutor_password
,
tutor_gender
,
tutor_status
,
tutor_image
,
tutor_Stream
,
tutor_subjects
,
tutor_class_types
,
tutor_main_district
,
tutor_main_city
,
tutor_medium
,
tutor_instituteID
});
newTutor
.
save
()
.
then
(()
=>
res
.
json
(
'
Tutor Successfully Added....
'
))
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Error:
'
+
err
));
const
tutor_instituteIDList
=
req
.
body
.
tutor_instituteIDList
;
//checking if the user is already exist in the database
const
user
=
await
tutor
.
findOne
({
tutor_email
:
req
.
body
.
tutor_email
})
if
(
!
user
){
const
newTutor
=
new
tutor
({
tutor_name
,
tutor_nic
,
tutor_email
,
tutor_phone
,
tutor_address
,
tutor_password
,
tutor_gender
,
tutor_status
,
tutor_image
,
tutor_Stream
,
tutor_subjects
,
isOnlineClass
,
isHomeVisit
,
isInstitute
,
tutor_main_district
,
tutor_main_city
,
tutor_medium
,
tutor_instituteIDList
});
newTutor
.
save
()
.
then
(
tutor
=>
{
console
.
log
(
"
Inside the New User
"
)
console
.
log
(
tutor
.
id
)
const
user_id
=
tutor
.
id
.
toString
();
const
user_nic
=
req
.
body
.
tutor_nic
;
const
user_email
=
req
.
body
.
tutor_email
;
const
user_password
=
req
.
body
.
tutor_password
;
const
user_type
=
"
Tutor
"
;
const
newUser
=
new
userAccount
({
user_id
,
user_nic
,
user_email
,
user_password
,
user_type
});
console
.
log
(
newUser
);
newUser
.
save
()
.
then
(
newUser
=>
{
console
.
log
(
"
Inside the Email Send part
"
)
////////////////////////////////////////////////////////////////////////////////////
// const content = `
// Hi ${tutor_name},\n
// You are Create a Tutor Account on SmartCoach.\n
// You can verify your email address click on 'http://localhost:3000/AccountVerified/${newUser.id}'
//
// Used your email address as username : ${user_email}
// Thank You,
// Team SmartCoach
// `;
//
// var mail = {
// from: tutor_name,
// to: user_email,
// subject: 'Email Verification - Tutor',
// text: content
// }
//
// transporter.sendMail(mail, (err, data) => {
// if (err) {
// res.json({
// msg: 'fail'
// })
// } else {
// res.json({
// msg: 'success'
// })
// }
// })
// ;
/////////////////////////////////////////////////////////////////////////////////////
})
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Error:
'
+
err
));
// res.json('Tutor Successfully Added....');
})
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Error:
'
+
err
));
}
else
{
return
res
.
status
(
500
).
json
(
'
Email already exit
'
);
}
});
// router.route('/update/:id').post((req,res) =>{
// userAccount.findById(req.params.id, function(err, details){
// if(!details){
// req.status(404).send("data is not found");
// }
// else {
// details.confirmed = true;
//
// details.save().then( () => {
// res.json('Item update!');
// })
// .catch(err => {
// res.status(400).send("Update not possible");
// });
// }
// })
// });
module
.
exports
=
router
;
BackEnd/WebBackEnd/routes/userAccount.route.js
0 → 100644
View file @
b8298554
const
router
=
require
(
'
express
'
).
Router
();
let
userAccount
=
require
(
'
../models/userAccount.user.model
'
);
router
.
route
(
'
/update/:id
'
).
post
((
req
,
res
)
=>
{
userAccount
.
findById
(
req
.
params
.
id
,
function
(
err
,
details
){
if
(
!
details
){
req
.
status
(
404
).
send
(
"
data is not found
"
);
}
else
{
details
.
confirmed
=
true
;
details
.
save
().
then
(
()
=>
{
res
.
json
(
'
Item update!
'
);
})
.
catch
(
err
=>
{
res
.
status
(
400
).
send
(
"
Update not possible
"
);
});
}
})
});
router
.
route
(
'
/getCredentials
'
).
post
((
req
,
res
)
=>
{
const
email
=
req
.
body
.
user_email
;
const
password
=
req
.
body
.
user_password
;
userAccount
.
find
({
user_email
:
email
,
user_password
:
password
},
function
(
err
,
User
)
{
}).
then
(
User
=>
res
.
json
(
User
))
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Error:
'
+
err
));
});
module
.
exports
=
router
;
BackEnd/WebBackEnd/server.js
View file @
b8298554
...
...
@@ -25,12 +25,14 @@ connection.once('open',() => {
const
studentRouter
=
require
(
'
./routes/student.route
'
);
const
tutorRouter
=
require
(
'
./routes/tutor.route
'
);
const
instituteRouter
=
require
(
'
./routes/institute.route
'
);
const
userAccount
=
require
(
'
./routes/userAccount.route
'
);
const
questionManage
=
require
(
'
./routes/question.route
'
);
const
financeRouter
=
require
(
'
./routes/finance.route
'
);
app
.
use
(
'
/studentSingUp
'
,
studentRouter
);
app
.
use
(
'
/tutorSingUp
'
,
tutorRouter
);
app
.
use
(
'
/instituteSingUp
'
,
instituteRouter
);
app
.
use
(
'
/userAccount
'
,
userAccount
);
app
.
use
(
'
/questions
'
,
questionManage
);
app
.
use
(
'
/admin/finance
'
,
financeRouter
);
...
...
WebFrontEnd/smartcoach-frontend/package-lock.json
View file @
b8298554
...
...
@@ -12472,6 +12472,16 @@
"resolved"
:
"https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz"
,
"integrity"
:
"sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
},
"react-notify-toast"
:
{
"version"
:
"0.5.1"
,
"resolved"
:
"https://registry.npmjs.org/react-notify-toast/-/react-notify-toast-0.5.1.tgz"
,
"integrity"
:
"sha512-VCTuvykAj3IBVX1ecVRxpo8csBJVGhKdJF4qk8c59nxbE4FPWmNpSAzyAMNNd0Mnxfwk8DA6Z0x8C/S0wCbbqg=="
,
"dev"
:
true
,
"requires"
:
{
"object-assign"
:
"^4.0.0"
,
"prop-types"
:
"^15.5.8"
}
},
"react-refresh"
:
{
"version"
:
"0.8.3"
,
"resolved"
:
"https://registry.npmjs.org/react-refresh/-/react-refresh-0.8.3.tgz"
,
...
...
WebFrontEnd/smartcoach-frontend/package.json
View file @
b8298554
...
...
@@ -41,6 +41,7 @@
]
},
"devDependencies"
:
{
"axios"
:
"^0.21.1"
"axios"
:
"^0.21.1"
,
"react-notify-toast"
:
"^0.5.1"
}
}
WebFrontEnd/smartcoach-frontend/src/App.js
View file @
b8298554
...
...
@@ -8,6 +8,8 @@ import Login from "./Components/Login";
import
ItemNav
from
"
./Components/Navbar
"
;
import
Home
from
"
./Components/Home
"
;
import
SignUp
from
"
./Components/SignUp
"
;
import
beforeConfirmation
from
"
./Components/beforeConfirmation
"
;
import
VerifiedAccount
from
"
./Components/AccountVerified
"
;
import
Dashboard
from
"
./Components/Admin/Dashboard
"
;
import
QuestionDetails
from
"
./Components/IT18050240/question_details
"
import
QuestionLayout
from
"
./Components/IT18050240/question_layout
"
...
...
@@ -22,6 +24,8 @@ function App() {
<
Route
path
=
"
/UserLogin
"
exact
component
=
{
Login
}
/
>
<
Route
path
=
"
/Home
"
exact
component
=
{
Home
}
/
>
<
Route
path
=
"
/SignUp
"
exact
component
=
{
SignUp
}
/
>
<
Route
path
=
"
/beforeConfirm
"
exact
component
=
{
beforeConfirmation
}
/
>
<
Route
path
=
"
/AccountVerified/:id
"
exact
component
=
{
VerifiedAccount
}
/
>
{
/*<Route path="/" exact component={Dashboard}/>*/
}
<
Switch
>
...
...
WebFrontEnd/smartcoach-frontend/src/Components/AccountVerified.js
0 → 100644
View file @
b8298554
import
React
,
{
Component
}
from
"
react
"
;
import
VerifiedIcon
from
"
../Images/verified.png
"
;
import
axios
from
"
axios
"
;
import
*
as
configs
from
"
../Config/config
"
;
export
default
class
AccountVerified
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
id
:
''
};
}
componentDidMount
()
{
console
.
log
(
this
.
props
.
match
.
params
.
id
)
this
.
setState
({
id
:
this
.
props
.
match
.
params
.
id
},
()
=>
{
axios
.
post
(
configs
.
BASE_URL
+
'
/userAccount/update/
'
+
this
.
state
.
id
)
})
}
render
()
{
return
(
<
div
className
=
"
container
"
style
=
{{
padding
:
'
10px
'
}}
>
<
div
style
=
{{
width
:
'
50%
'
,
margin
:
'
auto
'
,
marginTop
:
'
7%
'
,
padding
:
'
10px
'
,
paddingBottom
:
'
30px
'
,
border
:
'
solid
'
,
borderColor
:
'
#216E9B
'
}}
>
<
div
className
=
"
row
"
style
=
{{
display
:
'
contents
'
}}
>
<
img
src
=
{
VerifiedIcon
}
style
=
{{
width
:
'
80px
'
,
height
:
'
90px
'
}}
/
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
marginTop
:
'
10px
'
,
marginBottom
:
'
0px
'
,
display
:
'
flex
'
,
justifyContent
:
'
center
'
}}
>
<
h2
style
=
{{
fontFamily
:
'
emoji
'
,
color
:
'
#265077
'
,
margin
:
'
0px
'
,
textAlign
:
'
center
'
}}
>
Your
Email
is
Verified
<
/h2
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
marginTop
:
'
5px
'
,
marginBottom
:
'
0px
'
,
display
:
'
flex
'
,
justifyContent
:
'
center
'
}}
>
<
br
/>
<
span
>
Your
Account
has
been
successfully
verified
.
Thank
you
for
join
with
SmartCoach
.
Now
you
can
start
tutoring
in
SmartCoach
.
<
/span
>
<
br
/>
<
span
>
You
can
login
with
your
credentials
.
<
/span
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
marginTop
:
'
20px
'
,
marginBottom
:
'
0px
'
,
display
:
'
flex
'
,
justifyContent
:
'
center
'
}}
>
<
a
href
=
"
/UserLogin
"
type
=
"
submit
"
className
=
"
profile-edit-btn nav-link btn btn-primary
"
name
=
"
btnAddMore
"
style
=
{{
marginTop
:
'
20px
'
,
marginBottom
:
'
30px
'
,
width
:
'
50%
'
,
backgroundColor
:
'
#265077
'
,
borderColor
:
'
#216E9B
'
,
fontSize
:
'
12px
'
}}
>
Sign
In
<
/a
>
<
/div
>
<
/div
>
<
/div
>
)
}
}
\ No newline at end of file
WebFrontEnd/smartcoach-frontend/src/Components/Home.js
View file @
b8298554
...
...
@@ -9,6 +9,7 @@ import Star from "../Images/star.png";
import
ReviewImg
from
"
../Images/note.png
"
;
import
Calender
from
"
../Images/calender.png
"
;
import
StarBackGround
from
"
../Images/starboarder.png
"
;
import
ItemNav
from
"
./Navbar
"
;
export
default
class
Home
extends
Component
{
constructor
(
props
)
{
...
...
@@ -62,8 +63,16 @@ export default class Home extends Component{
render
()
{
return
(
<
div
className
=
"
App
"
style
=
{{
padding
:
'
10px
'
,
paddingTop
:
'
0px
'
}}
>
<
div
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
width
:
'
100%
'
}}
>
<
ItemNav
/>
<
/div
>
<
div
className
=
"
row
"
>
<
img
src
=
{
MianImage
}
style
=
{{
width
:
'
100%
'
,
height
:
'
250px
'
}}
/
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
marginRight
:
'
50px
'
,
marginLeft
:
'
50px
'
,
padding
:
'
5px
'
,
background
:
'
#1E4258
'
}}
>
<
div
className
=
"
col-4
"
style
=
{{
margin
:
'
5px
'
,
border
:
'
solid
'
,
padding
:
'
10px
'
,
borderColor
:
'
#216E9B
'
}}
>
...
...
WebFrontEnd/smartcoach-frontend/src/Components/Login.js
View file @
b8298554
import
React
,
{
Component
}
from
"
react
"
;
import
ItemNav
from
"
./Navbar
"
;
import
axios
from
"
axios
"
;
export
default
class
Login
extends
Component
{
...
...
@@ -21,29 +22,40 @@ export default class Login extends Component{
e
.
preventDefault
();
const
LogUser
=
{
email
:
this
.
state
.
email
,
password
:
this
.
state
.
password
user_
email
:
this
.
state
.
email
,
user_
password
:
this
.
state
.
password
}
const
email
=
this
.
state
.
email
;
// axios.post('http://localhost:5000/newUser/getCredentials', LogUser)
// .then(response => {
// console.log(response.data);
// if (response.data.length > 0) {
// console.log(response.data);
// console.log(response.data.password);
//
// localStorage.setItem("Name",response.data[0].name);
// localStorage.setItem("userID",response.data[0].id);
// window.location = '/Places';
// }
// else {
// alert("Email or Password Invalid!!!")
// }
//
//
// });
axios
.
post
(
'
http://localhost:5000/userAccount/getCredentials
'
,
LogUser
)
.
then
(
response
=>
{
console
.
log
(
response
.
data
);
if
(
response
.
data
.
length
>
0
)
{
console
.
log
(
response
.
data
);
console
.
log
(
response
.
data
.
password
);
// localStorage.setItem("Name",response.data[0].name);
// localStorage.setItem("userID",response.data[0].id);
if
(
response
.
data
[
0
].
user_type
===
'
Student
'
){
window
.
location
=
'
/Home
'
;
}
else
if
(
response
.
data
[
0
].
user_type
===
'
Tutor
'
){
window
.
location
=
'
/admin
'
;
}
else
if
(
response
.
data
[
0
].
user_type
===
'
Institute
'
){
window
.
location
=
'
/admin
'
;
}
//window.location = '/Places';
}
else
{
alert
(
"
Email or Password Invalid!!!
"
)
}
});
}
...
...
@@ -62,69 +74,72 @@ export default class Login extends Component{
render
()
{
return
(
<
div
className
=
"
container
"
style
=
{{
padding
:
'
10px
'
}}
>
<
div
>
<
div
style
=
{{
width
:
'
30%
'
,
margin
:
'
auto
'
,
marginTop
:
'
7%
'
,
padding
:
'
0px
'
,
paddingBottom
:
'
30px
'
,
border
:
'
solid
'
,
borderColor
:
'
#216E9B
'
}}
>
<
form
onSubmit
=
{
this
.
onSubmit
}
id
=
"
login
"
name
=
"
login
"
className
=
"
login
"
>
<
div
className
=
"
row
"
>
<
br
/>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
display
:
'
flex
'
,
justifyContent
:
'
center
'
}}
>
<
h3
style
=
{{
fontFamily
:
'
emoji
'
,
color
:
'
#265077
'
,
margin
:
'
20px
'
,
textAlign
:
'
center
'
}}
><
b
>
Login
<
/b></
h3
>
<
/div
>
<
div
>
<
div
className
=
"
row
"
style
=
{{
width
:
'
100%
'
,
margin
:
'
0px
'
}}
>
<
ItemNav
/>
<
/div
>
<
div
className
=
"
container
"
style
=
{{
padding
:
'
10px
'
}}
>
<
div
style
=
{{
width
:
'
35%
'
,
margin
:
'
auto
'
,
marginTop
:
'
7%
'
,
padding
:
'
0px
'
,
paddingBottom
:
'
30px
'
,
border
:
'
solid
'
,
borderColor
:
'
#216E9B
'
}}
>
<
form
onSubmit
=
{
this
.
onSubmit
}
id
=
"
login
"
name
=
"
login
"
className
=
"
login
"
>
<
div
className
=
"
row
"
>
<
br
/>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
display
:
'
flex
'
,
justifyContent
:
'
center
'
}}
>
<
h3
style
=
{{
fontFamily
:
'
emoji
'
,
color
:
'
#265077
'
,
margin
:
'
20px
'
,
textAlign
:
'
center
'
}}
><
b
>
Login
<
/b></
h3
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
display
:
'
flex
'
,
justifyContent
:
'
center
'
}}
>
<
label
style
=
{{
fontFamily
:
'
emoji
'
,
color
:
'
#A9BCC8
'
}}
>
Use
your
credentials
to
login
<
/label
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
margin
:
'
5px
'
}}
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
marginTop
:
'
10px
'
,
marginBottom
:
'
10px
'
}}
>
<
div
className
=
"
col-1
"
>
<
div
className
=
"
row
"
style
=
{{
display
:
'
flex
'
,
justifyContent
:
'
center
'
}}
>
<
label
style
=
{{
fontFamily
:
'
emoji
'
,
color
:
'
#A9BCC8
'
}}
>
Use
your
credentials
to
login
<
/label
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
margin
:
'
5px
'
}}
>
<
/div
>
<
div
className
=
"
col-10
"
>
<
input
type
=
"
email
"
id
=
"
email
"
className
=
"
form-control
"
placeholder
=
"
UserName
"
onChange
=
{
this
.
onChangeEmail
}
required
/>
<
div
className
=
"
row
"
style
=
{{
marginTop
:
'
10px
'
,
marginBottom
:
'
10px
'
}}
>
<
div
className
=
"
col-1
"
>
<
/div
>
<
div
className
=
"
col-10
"
>
<
input
type
=
"
email
"
id
=
"
email
"
className
=
"
form-control
"
placeholder
=
"
UserName
"
onChange
=
{
this
.
onChangeEmail
}
required
/>
<
/div
>
<
div
className
=
"
col-1
"
>
<
/div
>
<
/div
>
<
div
className
=
"
col-1
"
>
<
div
className
=
"
row
"
style
=
{{
marginTop
:
'
10px
'
,
marginBottom
:
'
10px
'
}}
>
<
div
className
=
"
col-1
"
>
<
/div
>
<
div
className
=
"
col-10
"
>
<
input
type
=
"
password
"
id
=
"
password
"
className
=
"
form-control
"
placeholder
=
"
Password
"
onChange
=
{
this
.
onChangePassword
}
required
/>
<
/div
>
<
div
className
=
"
col-1
"
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
marginTop
:
'
10px
'
,
marginBottom
:
'
10px
'
}}
>
<
div
className
=
"
col-1
"
>
<
div
className
=
"
row
"
style
=
{{
display
:
'
flex
'
,
justifyContent
:
'
center
'
}}
>
<
label
style
=
{{
fontFamily
:
'
emoji
'
,
color
:
'
#2353BA
'
}}
>
Forgot
Password
???
<
/label
>
<
/div
>
<
div
className
=
"
col-10
"
>
<
input
type
=
"
password
"
id
=
"
password
"
className
=
"
form-control
"
placeholder
=
"
Password
"
onChange
=
{
this
.
onChangePassword
}
required
/
>
<
div
className
=
"
row
"
style
=
{{
marginTop
:
'
5px
'
,
marginBottom
:
'
5px
'
,
display
:
'
flex
'
,
justifyContent
:
'
center
'
}}
>
<
button
type
=
"
submit
"
className
=
"
btn btn-primary
"
style
=
{{
width
:
'
50%
'
,
marginTop
:
'
0px
'
,
backgroundColor
:
'
#265077
'
,
borderColor
:
'
#216E9B
'
}}
><
b
>
Sign
In
<
/b></
button
>
<
/div
>
<
div
className
=
"
col-1
"
>
<
div
className
=
"
row
"
style
=
{{
marginTop
:
'
0px
'
,
marginBottom
:
'
5px
'
,
display
:
'
flex
'
,
justifyContent
:
'
center
'
}}
>
<
a
href
=
"
/SignUp
"
type
=
"
submit
"
className
=
"
profile-edit-btn nav-link btn btn-primary
"
name
=
"
btnAddMore
"
style
=
{{
marginTop
:
'
0px
'
,
marginBottom
:
'
20px
'
,
width
:
'
50%
'
,
backgroundColor
:
'
#2D5F5D
'
,
borderColor
:
'
#216E9B
'
,
fontSize
:
'
12px
'
}}
>
Sign
Up
<
/a
>
<
/div
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
display
:
'
flex
'
,
justifyContent
:
'
center
'
}}
>
<
label
style
=
{{
fontFamily
:
'
emoji
'
,
color
:
'
#2353BA
'
}}
>
Forgot
Password
???
<
/label
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
marginTop
:
'
5px
'
,
marginBottom
:
'
5px
'
,
display
:
'
flex
'
,
justifyContent
:
'
center
'
}}
>
<
button
type
=
"
submit
"
className
=
"
btn btn-primary
"
style
=
{{
width
:
'
50%
'
,
marginTop
:
'
0px
'
,
backgroundColor
:
'
#265077
'
,
borderColor
:
'
#216E9B
'
}}
><
b
>
Sign
In
<
/b></
button
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
marginTop
:
'
0px
'
,
marginBottom
:
'
5px
'
,
display
:
'
flex
'
,
justifyContent
:
'
center
'
}}
>
<
a
href
=
"
/SignUp
"
type
=
"
submit
"
className
=
"
profile-edit-btn nav-link btn btn-primary
"
name
=
"
btnAddMore
"
style
=
{{
marginTop
:
'
0px
'
,
marginBottom
:
'
20px
'
,
width
:
'
50%
'
,
backgroundColor
:
'
#2D5F5D
'
,
borderColor
:
'
#216E9B
'
,
fontSize
:
'
12px
'
}}
>
Sign
Up
<
/a
>
<
/div
>
<
/form
>
<
/div
>
<
/form
>
<
/div
>
<
/div
>
<
/div
>
)
...
...
WebFrontEnd/smartcoach-frontend/src/Components/SignUp.js
View file @
b8298554
This diff is collapsed.
Click to expand it.
WebFrontEnd/smartcoach-frontend/src/Components/beforeConfirmation.js
0 → 100644
View file @
b8298554
import
React
,
{
Component
}
from
"
react
"
;
import
ItemNav
from
"
./Navbar
"
;
import
ConfirmEmail
from
"
../Images/confirmemail.png
"
;
import
axios
from
"
axios
"
;
import
*
as
configs
from
"
../Config/config
"
;
export
default
class
beforeConfirmation
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
sNameList
:
[
'
Saman Deshapriya
'
,
'
Kamal Perera
'
,
'
asiri Deshapriya
'
,
'
Kelumsiri Perera
'
,
'
sahan Perera
'
,
'
Shaminda Perera
'
,
'
Kelum Perera
'
,
'
Kamal Surawera
'
,
'
damith madushan
'
,
'
kithmal Perera
'
,
'
banuka Perera
'
,
'
Kelumsiri Deshapriya
'
,
'
sahan Deshapriya
'
,
'
Shaminda Rajapaksha
'
,
'
Kelum Rajapaksha
'
,
'
Sunil madushan
'
,
'
kithmal Perera
'
,
'
Sumin Perera
'
,
'
asiri Rajapaksha
'
,
'
banuka Rajapaksha
'
,
'
Shamin Rajapaksha
'
,
'
Kelum Deshapriya
'
,
'
Sunil Akalanka
'
,
'
kithmal Akalanka
'
,
'
Sumin Akalanka
'
,
'
asiri Akalanka
'
,
'
banuka Akalanka
'
,
'
Shamin Akalanka
'
,
'
Kelum Athukorala
'
,
'
Sunil Athukorala
'
,
'
kithmal Athukorala
'
,
'
Sumin Athukorala
'
,
'
asiri Athukorala
'
,
'
banuka Athukorala
'
,
'
Shamin Athukorala
'
,
'
Kelum Pandula
'
,
'
Sunil Pandula
'
,
'
kithmal Pandula
'
,
'
Sumin Pandula
'
,
'
asiri Pandula
'
,
'
banuka Pandula
'
,
'
Shamin Pandula
'
,
'
Nuwan Pandula
'
,
'
Deemantha Pandula
'
,
'
Eashan Yoshitha
'
,
'
Madura Fernando
'
,
'
asiri Fernando
'
,
'
banuka Fernando
'
,
'
Shamin Fernando
'
,
'
Nuwan Fernando
'
,
'
Deemantha Fernando
'
,
'
Eashan Fernando
'
,
'
Madura Perera
'
,
'
Dasun Shanaka
'
,
'
Dinuka Fernando
'
,
'
Amal Fernando
'
],
sNameList2
:
[
'
Hemal Perera
'
,
'
Kithmal weeraraththne
'
,
'
Chaitha Dias
'
],
};
this
.
onSubmitStudent
=
this
.
onSubmitStudent
.
bind
(
this
);
}
onSubmitStudent
(){
let
NIC
=
981617300
;
const
fnameList
=
[
'
Lasitha
'
,
'
Thusitha
'
,
'
Bathika
'
,
'
Sameera
'
,
'
Kalana
'
,
'
Hirusha
'
,
'
Nipuna
'
,
'
Umesh
'
,
'
Rahal
'
,
'
Sachintha
'
,
'
Lasan
'
,
'
Kishara
'
,
'
Rasitha
'
,
'
Yehan
'
,
'
Yenuka
'
,
'
Thisara
'
,
'
Malindu
'
,
'
Milinda
'
,
'
Tharaka
'
,
'
Hansaka
'
,]
const
girlsList
=
[
'
Sammani
'
,
'
Tharaki
'
,
'
Tinali
'
,
'
Shanu
'
,
'
Divyani
'
,
'
Thakshila
'
,
'
Surangi
'
,
'
Sandani
'
,
'
Samadhi
'
,
'
Kavisha
'
,
'
Dilhani
'
,
'
Anusari
'
,
'
Kethaki
'
,
'
Gayathra
'
,
'
Ishanka
'
,
'
Samudhi
'
,
'
Shehani
'
,
'
Tharumini
'
,
'
Kasuni
'
,
'
Kalani
'
]
const
lName
=
'
Kempitiya
'
girlsList
.
map
(
name
=>
{
let
studentNIC
=
NIC
+
'
V
'
;
let
studentName
=
name
+
'
'
+
lName
;
const
res
=
studentName
.
replace
(
/ /g
,
''
)
let
studentEmail
=
res
.
toLowerCase
()
+
'
@gmail.com
'
;
let
studentPsw
=
'
Abc@123
'
;
const
student
=
{
student_name
:
studentName
,
student_nic
:
studentNIC
,
student_email
:
studentEmail
,
student_phone
:
'
0719855824
'
,
student_address
:
'
Colombo
'
,
student_password
:
studentPsw
,
student_gender
:
'
Female
'
,
student_image
:
''
,
guardian_name
:
'
ABC
'
,
guardian_email
:
'
abc@gmail.com
'
,
guardian_relationship
:
'
Mother
'
,
}
axios
.
post
(
configs
.
BASE_URL
+
'
/studentSingUp/add
'
,
student
)
.
then
(
res
=>
{
//console.log("Inside Then")
setTimeout
(()
=>
{
console
.
log
(
"
World!
"
);
},
2000
);
})
setTimeout
(()
=>
{
console
.
log
(
"
World!
"
);
},
2000
);
NIC
=
NIC
+
1
;
})
}
render
()
{
return
(
<
div
>
<
div
className
=
"
row
"
style
=
{{
width
:
'
100%
'
}}
>
<
ItemNav
/>
<
/div
>
<
div
style
=
{{
width
:
'
50%
'
,
margin
:
'
auto
'
,
marginTop
:
'
7%
'
,
padding
:
'
10px
'
,
paddingBottom
:
'
30px
'
,
border
:
'
solid
'
,
borderColor
:
'
#216E9B
'
}}
>
<
div
className
=
"
row
"
style
=
{{
display
:
'
contents
'
}}
>
<
img
src
=
{
ConfirmEmail
}
style
=
{{
width
:
'
300
'
,
height
:
'
300px
'
}}
/
>
<
/div
>
<
div
className
=
"
row
"
style
=
{{
padding
:
'
40px
'
}}
>
<
span
>
Your
Account
has
been
successfully
registered
.
To
complete
the
process
please
check
your
email
for
a
validation
request
<
/span
>
<
/div
>
{
/*<form onSubmit={this.onSubmitStudent}>*/
}
{
/* <div className="row" style={{padding: '40px'}}>*/
}
{
/* <button type="submit" className="btn btn-primary">Register</button>*/
}
{
/* </div>*/
}
{
/*</form>*/
}
<
/div
>
<
/div
>
)
}
}
\ No newline at end of file
WebFrontEnd/smartcoach-frontend/src/Images/confirmemail.png
0 → 100644
View file @
b8298554
35.9 KB
WebFrontEnd/smartcoach-frontend/src/Images/verified.png
0 → 100644
View file @
b8298554
31.2 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment