Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
assetmanagerLogin
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
arun.uday
assetmanagerLogin
Commits
a7bc9ea3
Commit
a7bc9ea3
authored
Mar 23, 2023
by
arun.uday
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AssetManager-V1.0- Not reviewed
Updated the code
parent
86779f3c
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
8 additions
and
7 deletions
+8
-7
scripts/core/handlers/__pycache__/login_handler.cpython-39.pyc
...ts/core/handlers/__pycache__/login_handler.cpython-39.pyc
+0
-0
scripts/core/handlers/__pycache__/normal_login.cpython-39.pyc
...pts/core/handlers/__pycache__/normal_login.cpython-39.pyc
+0
-0
scripts/core/handlers/login_handler.py
scripts/core/handlers/login_handler.py
+3
-2
scripts/core/handlers/normal_login.py
scripts/core/handlers/normal_login.py
+4
-4
scripts/log/AssetManagerlog.log
scripts/log/AssetManagerlog.log
+1
-0
scripts/services/v1/__pycache__/iot_manager_services.cpython-39.pyc
...rvices/v1/__pycache__/iot_manager_services.cpython-39.pyc
+0
-0
scripts/services/v1/iot_manager_services.py
scripts/services/v1/iot_manager_services.py
+0
-1
No files found.
scripts/core/handlers/__pycache__/login_handler.cpython-39.pyc
View file @
a7bc9ea3
No preview for this file type
scripts/core/handlers/__pycache__/normal_login.cpython-39.pyc
View file @
a7bc9ea3
No preview for this file type
scripts/core/handlers/login_handler.py
View file @
a7bc9ea3
...
@@ -8,9 +8,10 @@ from scripts.schemas.default_responses import DefaultFailureResponse, DefaultRes
...
@@ -8,9 +8,10 @@ from scripts.schemas.default_responses import DefaultFailureResponse, DefaultRes
class
LoginHandlers
:
class
LoginHandlers
:
def
__init__
(
self
):
def
__init__
(
self
):
self
.
obj_login_handler
=
NormalLogin
()
self
.
obj_login_handler
=
NormalLogin
()
self
.
login_type
=
""
def
normal_login
(
self
,
login_data
,
request
):
def
normal_login
(
self
,
login_data
,
request
):
self
.
login_type
=
"normal"
# decrypting the password from the UI
# decrypting the password from the UI
decrypted_password
=
self
.
obj_login_handler
.
password_decrypt
(
login_data
.
payload
[
"password"
])
decrypted_password
=
self
.
obj_login_handler
.
password_decrypt
(
login_data
.
payload
[
"password"
])
...
@@ -25,7 +26,7 @@ class LoginHandlers:
...
@@ -25,7 +26,7 @@ class LoginHandlers:
return
JSONResponse
(
content
=
DefaultFailureResponse
(
error
=
response
)
.
dict
(),
return
JSONResponse
(
content
=
DefaultFailureResponse
(
error
=
response
)
.
dict
(),
status_code
=
status
.
HTTP_400_BAD_REQUEST
)
status_code
=
status
.
HTTP_400_BAD_REQUEST
)
# checking for the account and password matching
# checking for the account and password matching
response
,
data
=
self
.
obj_login_handler
.
db_password_matching
(
login_data
.
payload
,
response
,
data
=
self
.
obj_login_handler
.
db_password_matching
(
self
.
login_type
,
login_data
.
payload
,
decrypted_password
)
decrypted_password
)
# if the passwords doesn't match with the db data
# if the passwords doesn't match with the db data
if
response
is
not
None
:
if
response
is
not
None
:
...
...
scripts/core/handlers/normal_login.py
View file @
a7bc9ea3
...
@@ -66,7 +66,7 @@ class NormalLogin:
...
@@ -66,7 +66,7 @@ class NormalLogin:
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
exception
(
e
)
logger
.
exception
(
e
)
def
db_data_validation
(
self
,
username
):
def
db_data_validation
(
self
,
login_type
,
username
):
try
:
try
:
# fetching the data based on the username
# fetching the data based on the username
self
.
db_user_data
=
MongoUser
()
.
fetch_user_details
(
username
)
self
.
db_user_data
=
MongoUser
()
.
fetch_user_details
(
username
)
...
@@ -76,7 +76,7 @@ class NormalLogin:
...
@@ -76,7 +76,7 @@ class NormalLogin:
"data"
:
{
"username"
:
username
}}
"data"
:
{
"username"
:
username
}}
# if the user is not registered through normal login
# if the user is not registered through normal login
if
self
.
db_user_data
[
"login_type"
]
!=
"normal"
:
if
self
.
db_user_data
[
"login_type"
]
!=
login_type
:
return
False
,
{
"message"
:
ErrorMessages
.
ERROR_LOGIN_TYPE_INVALID
,
return
False
,
{
"message"
:
ErrorMessages
.
ERROR_LOGIN_TYPE_INVALID
,
"data"
:
{
"username"
:
username
,
"Use Login"
:
self
.
db_user_data
[
"login_type"
]}}
"data"
:
{
"username"
:
username
,
"Use Login"
:
self
.
db_user_data
[
"login_type"
]}}
# Check the project id from the request body
# Check the project id from the request body
...
@@ -87,10 +87,10 @@ class NormalLogin:
...
@@ -87,10 +87,10 @@ class NormalLogin:
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
exception
(
e
)
logger
.
exception
(
e
)
def
db_password_matching
(
self
,
payload
,
password
):
def
db_password_matching
(
self
,
login_type
,
payload
,
password
):
try
:
try
:
# getting the response after checking for the user data in db
# getting the response after checking for the user data in db
response
,
message
=
self
.
db_data_validation
(
payload
[
"username"
])
response
,
message
=
self
.
db_data_validation
(
login_type
,
payload
[
"username"
])
# if the response is false then an error message is send back
# if the response is false then an error message is send back
if
response
is
not
None
:
if
response
is
not
None
:
return
response
,
message
return
response
,
message
...
...
scripts/log/AssetManagerlog.log
View file @
a7bc9ea3
...
@@ -877,3 +877,4 @@ TypeError: cannot unpack non-iterable NoneType object
...
@@ -877,3 +877,4 @@ TypeError: cannot unpack non-iterable NoneType object
2023-03-23 10:59:57 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-23 10:59:57 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-23 11:15:51 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-23 11:15:51 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-23 11:17:30 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-23 11:17:30 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-23 11:29:07 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
scripts/services/v1/__pycache__/iot_manager_services.cpython-39.pyc
View file @
a7bc9ea3
No preview for this file type
scripts/services/v1/iot_manager_services.py
View file @
a7bc9ea3
...
@@ -17,7 +17,6 @@ async def login_default(
...
@@ -17,7 +17,6 @@ async def login_default(
user_data
:
LoginRequest
,
request
:
MetaInfoSchema
=
Depends
(
auth
)
user_data
:
LoginRequest
,
request
:
MetaInfoSchema
=
Depends
(
auth
)
):
):
try
:
try
:
# mapper for login types
# mapper for login types
login_mapper
=
{
login_mapper
=
{
"normal"
:
obj_login_handler
.
normal_login
,
"normal"
:
obj_login_handler
.
normal_login
,
...
...
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