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
b798c3ce
Commit
b798c3ce
authored
Jan 28, 2021
by
kranthi.kumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
basic
parent
8f510cea
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
284 additions
and
0 deletions
+284
-0
scripts/app.py
scripts/app.py
+14
-0
scripts/handler/login_handler.py
scripts/handler/login_handler.py
+47
-0
scripts/handler/utility.py
scripts/handler/utility.py
+36
-0
scripts/service/login_service.py
scripts/service/login_service.py
+69
-0
scripts/templates/login.html
scripts/templates/login.html
+34
-0
scripts/templates/login_success.html
scripts/templates/login_success.html
+38
-0
scripts/templates/registration.html
scripts/templates/registration.html
+46
-0
No files found.
scripts/app.py
0 → 100644
View file @
b798c3ce
import
logging
from
flask
import
Flask
,
session
from
scripts.service.login_service
import
blueprint_object
app
=
Flask
(
__name__
)
app
.
secret_key
=
'super secret key'
app
.
register_blueprint
(
blueprint_object
)
try
:
if
__name__
==
'__main__'
:
app
.
run
(
port
=
8300
)
except
Exception
as
e
:
logging
.
exception
(
"Exception occurred"
,
exc_info
=
True
)
print
(
e
)
scripts/handler/login_handler.py
0 → 100644
View file @
b798c3ce
import
bcrypt
from
scripts.handler.utility
import
Mongo_utility
# creating object for class in Utility
utility_object
=
Mongo_utility
()
class
Mongobd
:
# method for inserting data into database
@
staticmethod
def
insert
(
data
,
username
):
# connecting to database
register_details
=
utility_object
.
connection
()
# find the data based on user_name in database
require_data
=
utility_object
.
finding
(
register_details
,
{
"User Id"
:
username
})
flag
=
0
# checking if user exists or not
if
len
(
list
(
require_data
))
==
0
:
flag
=
1
# if user not exists then inserting data to database
if
flag
==
1
:
utility_object
.
insert
(
register_details
,
data
)
return
flag
# method for validating user data with database
@
staticmethod
def
find_query
(
username
,
password
):
# connecting to database
register_details
=
utility_object
.
connection
()
cursor_list
=
list
(
utility_object
.
finding
(
register_details
,
{
"User Id"
:
username
}))
flag
=
0
# checking if user exists or not
if
len
(
cursor_list
)
!=
0
:
# if user exists then finding the password using username as query
cursor
=
utility_object
.
finding
(
register_details
,
{
"User Id"
:
username
})
for
key
,
value
in
cursor
.
next
()
.
items
():
# validating user password with database password
# we use bcrypt.checkpw to compare hashed password
if
key
==
"Password"
and
bcrypt
.
checkpw
(
password
.
encode
(
'utf8'
),
value
):
flag
=
1
break
else
:
flag
=
2
return
flag
scripts/handler/utility.py
0 → 100644
View file @
b798c3ce
import
logging
from
pymongo
import
MongoClient
class
Mongo_utility
:
# method for connecting with database
@
staticmethod
def
connection
():
try
:
# database details
client
=
MongoClient
(
'143.110.191.155'
,
37217
)
# kranthi -> database name
database
=
client
.
kranthi
# register_details -> collection name
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
:
# inserting data into database.
register_details
.
insert
(
data
)
except
Exception
:
logging
.
exception
(
"Exception occurred"
,
exc_info
=
True
)
@
staticmethod
def
finding
(
register_details
,
query
):
try
:
# finding data based on query
details
=
register_details
.
find
(
query
)
return
details
except
Exception
:
logging
.
exception
(
"Exception occurred"
,
exc_info
=
True
)
scripts/service/login_service.py
0 → 100644
View file @
b798c3ce
import
logging
import
bcrypt
from
flask
import
Blueprint
from
flask
import
render_template
,
request
,
flash
from
scripts.handler.login_handler
import
Mongobd
blueprint_object
=
Blueprint
(
'example_blueprint'
,
__name__
)
mongodb_object
=
Mongobd
()
try
:
# To open login page
@
blueprint_object
.
route
(
'/login'
)
def
message
():
return
render_template
(
'login.html'
)
# To open registration page
@
blueprint_object
.
route
(
'/registration'
)
def
message1
():
return
render_template
(
'registration.html'
)
# To get registration details
@
blueprint_object
.
route
(
'/registration_data'
,
methods
=
[
'POST'
])
def
input_values
():
# collecting user details from registration.html
data
=
{
"Name"
:
request
.
form
[
"name"
],
"Phone number"
:
request
.
form
[
"number"
],
"Mail id"
:
request
.
form
[
"mail"
],
"User Id"
:
request
.
form
[
"user_id"
],
"Password"
:
bcrypt
.
hashpw
((
request
.
form
[
"password"
])
.
encode
(
'utf8'
),
bcrypt
.
gensalt
())}
# sending data to the database.
result
=
mongodb_object
.
insert
(
data
,
request
.
form
[
"user_id"
])
if
result
==
1
:
# works when user is successfully register
flash
(
"you have successfully register. you can login here :"
)
# It redirect to login page after successfully register
return
render_template
(
'login.html'
)
else
:
# If user enter the same user Id already exists
error
=
"User id already exists"
# It redirect to registration page along with error
return
render_template
(
'registration.html'
,
error
=
error
)
# To get login details
@
blueprint_object
.
route
(
'/login_data'
,
methods
=
[
'POST'
])
def
required_values
():
# sending the username,password for checking
result
=
mongodb_object
.
find_query
(
request
.
form
[
"username"
],
request
.
form
[
"pwd"
])
if
result
==
1
:
# work when login details are correct and redirect to website page
return
render_template
(
'login_success.html'
)
elif
result
==
2
:
# work when user is new to website
error
=
"First Register here"
# It redirect to registration page along with error
return
render_template
(
'registration.html'
,
error
=
error
)
else
:
# Works when user entered new password
error
=
"please enter correct password"
# It redirect to login page along with error
return
render_template
(
'login.html'
,
error
=
error
)
except
Exception
as
e
:
logging
.
exception
(
"Exception occurred in connection"
,
exc_info
=
True
)
print
(
e
)
scripts/templates/login.html
0 → 100644
View file @
b798c3ce
<!Doctype html>
<html>
<body
style=
"background-color:powderblue;"
>
{% with messages = get_flashed_messages() %}
{% if messages %}
{% for message in messages %}
<p>
{{ message }}
</p>
{% endfor %}
{% endif %}
{% endwith %}
{% if error %}
<p><strong>
Error
</strong>
: {{error}}
</p>
{% endif %}
<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_success.html
0 → 100644
View file @
b798c3ce
<!Doctype html>
<html>
<body
style=
"background-color:powderblue;"
>
<h1
align=
"center"
>
welcome to Knowledge lens
</h1>
<h3>
About us
</h3>
<h4>
Knowledge Lens is a US and India based product and services technology company that builds innovative solutions on
niche technology areas such as Big Data Analytics, Data Science, Artificial Intelligence, IoT, Blockchain, AR/VR and
Cloud.
We have successfully transformed companies into Smart Enterprises by implementing Next Generation Enterprise Data
Lakes, AI Powered Intelligent Apps and Industry 4.0 solutions both on premise and cloud.
Our mission is to discover intelligent insights from enterprise data and deliver business value to customers. We
have a technically strong team of 350+ experts working to add differentiated value to our customers. What truly sets
us apart is the use of a microservice-based architecture, to expand solution capabilities without disrupting
critical business activities. This enables us to provide user-focused, domain-specific software applications built
on cutting edge, adaptive technologies.
</h4>
<h3>
Your Products:
</h3>
<h3>
GLens
</h3>
<h4>
GLens is Real-Time Data Acquisition, Monitoring and
Analytics suite of Products for Industrial Emissions, Effluent Discharges and Ambient Air Monitoring. GLens DAS
Software, GLens Server Platform, GLens Environ Data Logger provides a comprehensive solution for all Industry
Environmental needs.
</h4>
<h3>
MLens
</h3>
<h4>
MLens is an accelerator toolkit from Knowledge Lens which
enables Workload Migration, Cloud Data Management
&
Automated Disaster Recovery for Enterprise. We provide migration
utilities to migrate data, metadata
&
transform computational workloads in Hadoop environment to Databricks Unified
Analytics.
</h4>
<h3>
ILens
</h3>
<h4>
iLens is our premier Industrial IoT solution, addressing
Industry 4.0 demands with capabilities including Interface Connectivity, Edge Analytics and Predictive Analytics. We
are currently powering automation, manufacturing, energy and utility companies across the world.
</h4>
</body>
</html>
\ No newline at end of file
scripts/templates/registration.html
0 → 100644
View file @
b798c3ce
<!Doctype html>
<html>
<body
style=
"background-color:powderblue;"
>
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul>
{% for message in messages %}
<li>
{{ message }}
</li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
{% if error %}
<p><strong>
Error
</strong>
: {{error}}
</p>
{% endif %}
<h1
align=
"center"
>
Welcome To Knowledge 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></td>
</tr>
</table>
</form>
</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