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
2f6951ee
Commit
2f6951ee
authored
Jan 29, 2021
by
kranthi.kumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update login_handler.py
parent
6a261d7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
7 deletions
+4
-7
scripts/handler/login_handler.py
scripts/handler/login_handler.py
+4
-7
No files found.
scripts/handler/login_handler.py
View file @
2f6951ee
import
bcrypt
from
scripts.handler.utility
import
Mongo_utility
# creating object for class in Utility
...
...
@@ -10,8 +8,8 @@ class Mongobd:
# method for inserting data into database
@
staticmethod
def
insert
(
data
,
username
,
password
):
# hashing the password
data
[
"Password"
]
=
bcrypt
.
hashpw
(
password
.
encode
(
'utf8'
),
bcrypt
.
gensalt
()
)
# hashing the password
by calling hashing method in utility
data
[
"Password"
]
=
utility_object
.
hashing
(
password
,
''
)
# connecting to database
register_details
=
utility_object
.
connection
()
# find the data based on user_name in database
...
...
@@ -39,9 +37,8 @@ class Mongobd:
# 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
):
# validating user password with database password by calling hashing method in utility
if
key
==
"Password"
and
utility_object
.
hashing
(
password
,
value
):
flag
=
1
break
else
:
...
...
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