Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-028
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
2023-028
2023-028
Commits
255c1815
Commit
255c1815
authored
Oct 30, 2023
by
Ramanayaka D.H.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
5e50c4fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
0 deletions
+64
-0
register_new.py
register_new.py
+64
-0
No files found.
register_new.py
0 → 100644
View file @
255c1815
import
dash
from
dash
import
html
,
dcc
,
Input
,
Output
,
State
from
dash.exceptions
import
PreventUpdate
import
pymongo
import
dash_bootstrap_components
as
dbc
from
app
import
app
# Connect to MongoDB # creating a MongoDB client object named client. This line establishes a connection to the MongoDB database
client
=
pymongo
.
MongoClient
(
"mongodb+srv://admin:admin@cluster0.afxihmt.mongodb.net/"
)
db
=
client
[
"user_database"
]
#creates a reference to a specific MongoDB database called "user_database".
users_collection
=
db
[
"users"
]
#accessing a specific collection within the "user_database" database.
# Define the layout of the registration page
# reg = html.Div([
# html.H1("Registration Page"),
# html.Div([
# html.Label("Username"),
# dcc.Input(id="username-input", type="text"),
# html.Label("Password"),
# dcc.Input(id="password-input", type="password"),
# html.Button("Register", id="register-button"),
# html.Div(id="registration-status")
# ])
# ])
reg
=
html
.
Div
([
html
.
Div
([
html
.
H1
(
"Registration"
),
#title for the registration form
html
.
Div
([
dcc
.
Input
(
id
=
'logger_store'
,
value
=
"reg"
,
type
=
'hidden'
),
html
.
Div
([
html
.
Label
(
"Email address"
),
#Label for email address
dcc
.
Input
(
id
=
"username-input"
,
type
=
"email"
,
className
=
"form-control"
,
placeholder
=
"Enter email"
),
],
className
=
"login-inner-box-input"
),
html
.
Div
([
html
.
Label
(
"Password"
),
#Label for PW
dcc
.
Input
(
id
=
"password-input"
,
type
=
"password"
,
className
=
"form-control"
,
placeholder
=
"Password"
)],
className
=
"login-inner-box-input"
),
html
.
Center
([
dbc
.
Button
(
"Register"
,
className
=
"btn btn-light"
,
id
=
"register-button"
)])
,
#button to register
html
.
Div
(
id
=
"register-status"
)
])
],
className
=
"card login-inner-box"
),
#apply CSS classes to format the elements
html
.
Img
(
src
=
app
.
get_asset_url
(
'register.gif'
),
id
=
"login-vector"
)
#to give an image on to the register componenet
],
className
=
"login-outer-box"
)
log
=
html
.
Div
([
#main container for the web page or section of the web page.
html
.
Div
([
#creates a hidden input field with the id attribute 'logger_store' and an initial value of "login.
dcc
.
Input
(
id
=
'logger_store'
,
value
=
"login"
,
type
=
'hidden'
),
html
.
H1
(
"Login"
),
#title "Login"
html
.
Div
([
html
.
Div
([
html
.
Label
(
"Email address"
),
#Label #to input email
dcc
.
Input
(
id
=
"username-input"
,
type
=
"email"
,
className
=
"form-control"
,
placeholder
=
"Enter email"
),
],
className
=
"login-inner-box-input"
),
html
.
Div
([
html
.
Label
(
"Password"
),
#Label #to input password
dcc
.
Input
(
id
=
"password-input"
,
type
=
"password"
,
className
=
"form-control"
,
placeholder
=
"Password"
)],
className
=
"login-inner-box-input"
),
html
.
Center
([
dbc
.
Button
(
"Login"
,
className
=
"btn btn-light"
,
id
=
"register-button"
)])
,
#login button
html
.
Div
(
id
=
"register-status"
)
])
],
className
=
"card login-inner-box"
),
#used to apply CSS classes to format the elements.
html
.
Img
(
src
=
app
.
get_asset_url
(
'login.gif'
),
id
=
"login-vector"
)
#to give an image on to the login componenet
],
className
=
"login-outer-box"
)
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