Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
Login
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
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kranthi.kumar
Login
Commits
0b0caf3f
Commit
0b0caf3f
authored
Jan 27, 2021
by
kranthi.kumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
basic
parent
a33458bd
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
200 additions
and
0 deletions
+200
-0
scripts/app.py
scripts/app.py
+13
-0
scripts/handler/login_handler.py
scripts/handler/login_handler.py
+22
-0
scripts/handler/utility.py
scripts/handler/utility.py
+33
-0
scripts/service/login_service.py
scripts/service/login_service.py
+51
-0
scripts/templates/login.html
scripts/templates/login.html
+24
-0
scripts/templates/login_fail.html
scripts/templates/login_fail.html
+8
-0
scripts/templates/login_success.html
scripts/templates/login_success.html
+7
-0
scripts/templates/registration.html
scripts/templates/registration.html
+34
-0
scripts/templates/registration_success.html
scripts/templates/registration_success.html
+8
-0
No files found.
scripts/app.py
0 → 100644
View file @
0b0caf3f
import
logging
from
flask
import
Flask
from
scripts.service.login_service
import
blueprint_inserter
app
=
Flask
(
__name__
)
app
.
register_blueprint
(
blueprint_inserter
)
try
:
if
__name__
==
'__main__'
:
app
.
run
(
port
=
8200
)
except
Exception
as
e
:
logging
.
exception
(
"Exception occurred"
,
exc_info
=
True
)
print
(
e
)
scripts/handler/login_handler.py
0 → 100644
View file @
0b0caf3f
from
scripts.handler.utility
import
Mongo_utility
utility_object
=
Mongo_utility
()
class
Mongobd
:
@
staticmethod
def
insert
(
data
):
register_details
=
utility_object
.
connection
()
utility_object
.
insert
(
register_details
,
data
)
@
staticmethod
def
find_query
(
username
,
password
):
register_details
=
utility_object
.
connection
()
myCursor
=
utility_object
.
finding
(
register_details
,
{
"User Id"
:
username
})
# pawd= utility_object.finding(register_details, {"Password": password})
flag
=
0
for
key
,
value
in
myCursor
.
next
()
.
items
():
if
(
key
==
"Password"
and
value
==
password
):
flag
=
1
return
flag
scripts/handler/utility.py
0 → 100644
View file @
0b0caf3f
import
logging
from
pymongo
import
MongoClient
class
Mongo_utility
:
@
staticmethod
def
connection
():
try
:
client
=
MongoClient
(
'143.110.191.155'
,
37217
)
database
=
client
.
kranthi
register_details
=
database
.
register_details
return
register_details
except
Exception
:
logging
.
exception
(
"Exception occurred in connection"
,
exc_info
=
True
)
@
staticmethod
def
insert
(
register_details
,
data
):
try
:
# we can use insert_many for insertion all records at a time.
register_details
.
insert
(
data
)
except
Exception
:
logging
.
exception
(
"Exception occurred"
,
exc_info
=
True
)
@
staticmethod
def
finding
(
register_details
,
query
):
try
:
details
=
register_details
.
find
(
query
)
return
details
except
Exception
:
logging
.
exception
(
"Exception occurred"
,
exc_info
=
True
)
raise
Exception
(
"Problem in Searching"
)
scripts/service/login_service.py
0 → 100644
View file @
0b0caf3f
import
json
import
logging
from
flask
import
Blueprint
from
flask
import
render_template
,
request
from
scripts.handler.login_handler
import
Mongobd
blueprint_inserter
=
Blueprint
(
'example_blueprint'
,
__name__
)
mongodb_object
=
Mongobd
()
try
:
@
blueprint_inserter
.
route
(
'/login'
)
def
message
():
return
render_template
(
'login.html'
)
@
blueprint_inserter
.
route
(
'/registration'
)
def
message1
():
return
render_template
(
'registration.html'
)
@
blueprint_inserter
.
route
(
'/registration_success'
)
def
message2
():
return
render_template
(
'registration_success.html'
)
@
blueprint_inserter
.
route
(
'/registration_data'
,
methods
=
[
'POST'
])
def
input_values
():
data
=
{
"Name"
:
request
.
form
[
"name"
],
"Phone number"
:
request
.
form
[
"number"
],
"Mail id"
:
request
.
form
[
"mail"
],
"User Id"
:
request
.
form
[
"user_id"
],
"Password"
:
request
.
form
[
"password"
]}
mongodb_object
.
insert
(
data
)
return
render_template
(
'registration_success.html'
)
@
blueprint_inserter
.
route
(
'/login_data'
,
methods
=
[
'POST'
])
def
required_values
():
result
=
mongodb_object
.
find_query
(
request
.
form
[
"username"
],
request
.
form
[
"pwd"
])
if
(
result
==
1
):
return
render_template
(
'login_success.html'
)
else
:
return
render_template
(
'login_fail.html'
)
except
Exception
as
e
:
logging
.
exception
(
"Exception occurred in connection"
,
exc_info
=
True
)
print
(
e
)
scripts/templates/login.html
0 → 100644
View file @
0b0caf3f
<!Doctype html>
<html>
<body
style=
"background-color:powderblue;"
>
<h1
align=
"center"
>
Welcome To Knowledge Lens
</h1>
<h2
align=
"center"
>
Login Page
</h2>
<form
name=
"f1"
action=
"login_data"
method=
"post"
>
<table
align=
"center"
border=
"0"
bgcolor=
"green"
cellspacing=
"10"
cellpadding=
"5"
>
<td>
Username:
</td>
<td><input
type=
"text"
size=
25
name=
"username"
required
></td>
</tr></tr></tr>
<td>
Password:
</td>
<td><input
type=
"Password"
size=
25
name=
"pwd"
required
></td>
</tr>
<tr>
<td><input
type=
"submit"
name=
"b1"
value=
"login"
></td>
<td>
<a
href=
"registration"
>
<input
type=
"button"
onclick=
"registration"
value=
"Registration"
>
</a>
</td>
</table>
</form>
</body>
</html>
\ No newline at end of file
scripts/templates/login_fail.html
0 → 100644
View file @
0b0caf3f
<!Doctype html>
<html>
<body
style=
"background-color:powderblue;"
>
<h1
align=
"center"
>
Login Fail . Please try again
</h1>
<a
href=
"login"
>
click here to Login :
<input
type=
"button"
onclick=
"login"
value=
"login"
></a>
</body>
</html>
\ No newline at end of file
scripts/templates/login_success.html
0 → 100644
View file @
0b0caf3f
<!Doctype html>
<html>
<body
style=
"background-color:powderblue;"
>
<h1
align=
"center"
>
login Successfull
</h1>
</body>
</html>
\ No newline at end of file
scripts/templates/registration.html
0 → 100644
View file @
0b0caf3f
<!Doctype html>
<html>
<body
style=
"background-color:powderblue;"
>
<h1
align=
"center"
>
Welcome To Knoeledge Lens
</h1>
<h2
align=
"center"
>
REGISTRATION PAGE
</h2>
<form
name=
"f1"
action=
"registration_data"
method=
"post"
>
<table
align=
"center"
border=
"0"
bgcolor=
"green"
cellspacing=
"10"
cellpadding=
"5"
>
<tr>
<td>
Name:
</td>
<td><input
type=
"text"
name=
"name"
size=
"15"
required
></td>
</tr>
<tr>
<td>
Phone No:
</td>
<td><input
type=
"text"
name=
"number"
size=
"15"
required
></td>
</tr>
<tr>
<td>
Mail id:
</td>
<td><input
type=
"email"
name=
"mail"
size=
"15"
required
></td>
</tr>
<tr>
<td>
User id:
</td>
<td><input
type=
"text"
name=
"user_id"
size=
"15"
required
></td>
</tr>
<tr>
<td>
Password:
</td>
<td><input
type=
"password"
name=
"password"
size=
"15"
required
></td>
</tr>
<tr>
<td><a
href=
"registration_success"
><input
type=
"submit"
onclick=
"login"
value=
"Register"
></a></a></td>
td>
</tr>
</table>
</form>
</body>
</html>
\ No newline at end of file
scripts/templates/registration_success.html
0 → 100644
View file @
0b0caf3f
<!Doctype html>
<html>
<body
style=
"background-color:powderblue;"
>
<h1
align=
"center"
>
RegiStration Successfull
</h1>
<a
href=
"login"
>
click here to Login :
<input
type=
"button"
onclick=
"login"
value=
"login"
></a>
</body>
</html>
\ No newline at end of file
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