square-administration 3.2.2__tar.gz → 3.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {square_administration-3.2.2 → square_administration-3.3.0}/PKG-INFO +8 -1
  2. {square_administration-3.2.2 → square_administration-3.3.0}/README.md +7 -0
  3. square_administration-3.3.0/pyproject.toml +3 -0
  4. {square_administration-3.2.2 → square_administration-3.3.0}/setup.py +1 -1
  5. square_administration-3.3.0/square_administration/pydantic_models/authentication.py +34 -0
  6. {square_administration-3.2.2 → square_administration-3.3.0}/square_administration/routes/authentication.py +194 -0
  7. {square_administration-3.2.2 → square_administration-3.3.0}/square_administration.egg-info/PKG-INFO +8 -1
  8. {square_administration-3.2.2 → square_administration-3.3.0}/square_administration.egg-info/SOURCES.txt +1 -0
  9. square_administration-3.2.2/square_administration/pydantic_models/authentication.py +0 -16
  10. {square_administration-3.2.2 → square_administration-3.3.0}/setup.cfg +0 -0
  11. {square_administration-3.2.2 → square_administration-3.3.0}/square_administration/__init__.py +0 -0
  12. {square_administration-3.2.2 → square_administration-3.3.0}/square_administration/configuration.py +0 -0
  13. {square_administration-3.2.2 → square_administration-3.3.0}/square_administration/data/config.sample.ini +0 -0
  14. {square_administration-3.2.2 → square_administration-3.3.0}/square_administration/data/config.testing.sample.ini +0 -0
  15. {square_administration-3.2.2 → square_administration-3.3.0}/square_administration/main.py +0 -0
  16. {square_administration-3.2.2 → square_administration-3.3.0}/square_administration/messages.py +0 -0
  17. {square_administration-3.2.2 → square_administration-3.3.0}/square_administration/pydantic_models/__init__.py +0 -0
  18. {square_administration-3.2.2 → square_administration-3.3.0}/square_administration/pydantic_models/core.py +0 -0
  19. {square_administration-3.2.2 → square_administration-3.3.0}/square_administration/routes/__init__.py +0 -0
  20. {square_administration-3.2.2 → square_administration-3.3.0}/square_administration/routes/core.py +0 -0
  21. {square_administration-3.2.2 → square_administration-3.3.0}/square_administration/utils/__init__.py +0 -0
  22. {square_administration-3.2.2 → square_administration-3.3.0}/square_administration/utils/common.py +0 -0
  23. {square_administration-3.2.2 → square_administration-3.3.0}/square_administration.egg-info/dependency_links.txt +0 -0
  24. {square_administration-3.2.2 → square_administration-3.3.0}/square_administration.egg-info/requires.txt +0 -0
  25. {square_administration-3.2.2 → square_administration-3.3.0}/square_administration.egg-info/top_level.txt +0 -0
  26. {square_administration-3.2.2 → square_administration-3.3.0}/tests/__init__.py +0 -0
  27. {square_administration-3.2.2 → square_administration-3.3.0}/tests/conftest.py +0 -0
  28. {square_administration-3.2.2 → square_administration-3.3.0}/tests/test_1.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: square_administration
3
- Version: 3.2.2
3
+ Version: 3.3.0
4
4
  Summary: common business layer for my personal server.
5
5
  Home-page: https://github.com/thepmsquare/square_administration
6
6
  Author: thePmSquare
@@ -32,6 +32,13 @@ pip install square_administration
32
32
 
33
33
  ## changelog
34
34
 
35
+ ### v3.3.0
36
+
37
+ - authentication
38
+ - add new endpoint -> register_login_google_v0.
39
+ - add new endpoint -> reset_password_and_login_using_backup_code_v0.
40
+ - add new endpoint -> reset_password_and_login_using_reset_email_code_v0.
41
+
35
42
  ### v3.2.2
36
43
 
37
44
  - remove config.ini and config.testing.ini from version control.
@@ -16,6 +16,13 @@ pip install square_administration
16
16
 
17
17
  ## changelog
18
18
 
19
+ ### v3.3.0
20
+
21
+ - authentication
22
+ - add new endpoint -> register_login_google_v0.
23
+ - add new endpoint -> reset_password_and_login_using_backup_code_v0.
24
+ - add new endpoint -> reset_password_and_login_using_reset_email_code_v0.
25
+
19
26
  ### v3.2.2
20
27
 
21
28
  - remove config.ini and config.testing.ini from version control.
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ requires = ["setuptools>=75.3.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
@@ -4,7 +4,7 @@ package_name = "square_administration"
4
4
 
5
5
  setup(
6
6
  name=package_name,
7
- version="3.2.2",
7
+ version="3.3.0",
8
8
  packages=find_packages(),
9
9
  package_data={
10
10
  package_name: ["data/*"],
@@ -0,0 +1,34 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class RegisterUsernameV0(BaseModel):
5
+ username: str
6
+ password: str
7
+ admin_password: str
8
+
9
+
10
+ class LoginUsernameV0(BaseModel):
11
+ username: str
12
+ password: str
13
+
14
+
15
+ class RemoveAppForSelfV0(BaseModel):
16
+ password: str
17
+
18
+
19
+ class RegisterLoginGoogleV0(BaseModel):
20
+ google_id: str
21
+
22
+
23
+ class ResetPasswordAndLoginUsingBackupCodeV0(BaseModel):
24
+ backup_code: str
25
+ username: str
26
+ new_password: str
27
+ logout_other_sessions: bool = False
28
+
29
+
30
+ class ResetPasswordAndLoginUsingResetEmailCodeV0(BaseModel):
31
+ reset_email_code: str
32
+ username: str
33
+ new_password: str
34
+ logout_other_sessions: bool = False
@@ -26,6 +26,9 @@ from square_administration.pydantic_models.authentication import (
26
26
  RegisterUsernameV0,
27
27
  LoginUsernameV0,
28
28
  RemoveAppForSelfV0,
29
+ RegisterLoginGoogleV0,
30
+ ResetPasswordAndLoginUsingBackupCodeV0,
31
+ ResetPasswordAndLoginUsingResetEmailCodeV0,
29
32
  )
30
33
  from square_administration.utils.common import is_https, global_int_app_id
31
34
 
@@ -481,3 +484,194 @@ async def generate_access_token_v0(
481
484
  return JSONResponse(
482
485
  status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, content=output_content
483
486
  )
487
+
488
+
489
+ @router.post("/register_login_google/v0")
490
+ @global_object_square_logger.auto_logger()
491
+ async def register_login_google_v0(body: RegisterLoginGoogleV0):
492
+ google_id = body.google_id
493
+ try:
494
+ """
495
+ validation
496
+ """
497
+ # pass
498
+ """
499
+ main process
500
+ """
501
+ response = global_object_square_authentication_helper.register_login_google_v0(
502
+ google_id=google_id,
503
+ assign_app_id_if_missing=False,
504
+ app_id=global_int_app_id,
505
+ )
506
+ """
507
+ return value
508
+ """
509
+
510
+ return JSONResponse(
511
+ status_code=status.HTTP_200_OK,
512
+ content=response,
513
+ )
514
+ except HTTPError as http_error:
515
+ global_object_square_logger.logger.error(http_error, exc_info=True)
516
+ """
517
+ rollback logic
518
+ """
519
+ # pass
520
+ return JSONResponse(
521
+ status_code=http_error.response.status_code,
522
+ content=json.loads(http_error.response.content),
523
+ )
524
+ except HTTPException as http_exception:
525
+ global_object_square_logger.logger.error(http_exception, exc_info=True)
526
+ """
527
+ rollback logic
528
+ """
529
+ # pass
530
+ return JSONResponse(
531
+ status_code=http_exception.status_code, content=http_exception.detail
532
+ )
533
+ except Exception as e:
534
+ global_object_square_logger.logger.error(e, exc_info=True)
535
+ """
536
+ rollback logic
537
+ """
538
+ # pass
539
+ output_content = get_api_output_in_standard_format(
540
+ message=messages["GENERIC_500"],
541
+ log=str(e),
542
+ )
543
+ return JSONResponse(
544
+ status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, content=output_content
545
+ )
546
+
547
+
548
+ @router.post("/reset_password_and_login_using_backup_code/v0")
549
+ @global_object_square_logger.auto_logger()
550
+ async def reset_password_and_login_using_backup_code_v0(
551
+ body: ResetPasswordAndLoginUsingBackupCodeV0,
552
+ ):
553
+ backup_code = body.backup_code
554
+ username = body.username
555
+ new_password = body.new_password
556
+ logout_other_sessions = body.logout_other_sessions
557
+ try:
558
+ """
559
+ validation
560
+ """
561
+ # pass
562
+ """
563
+ main process
564
+ """
565
+ response = global_object_square_authentication_helper.reset_password_and_login_using_backup_code_v0(
566
+ backup_code=backup_code,
567
+ username=username,
568
+ new_password=new_password,
569
+ app_id=global_int_app_id,
570
+ logout_other_sessions=logout_other_sessions,
571
+ )
572
+ """
573
+ return value
574
+ """
575
+
576
+ return JSONResponse(
577
+ status_code=status.HTTP_200_OK,
578
+ content=response,
579
+ )
580
+ except HTTPError as http_error:
581
+ global_object_square_logger.logger.error(http_error, exc_info=True)
582
+ """
583
+ rollback logic
584
+ """
585
+ # pass
586
+ return JSONResponse(
587
+ status_code=http_error.response.status_code,
588
+ content=json.loads(http_error.response.content),
589
+ )
590
+ except HTTPException as http_exception:
591
+ global_object_square_logger.logger.error(http_exception, exc_info=True)
592
+ """
593
+ rollback logic
594
+ """
595
+ # pass
596
+ return JSONResponse(
597
+ status_code=http_exception.status_code, content=http_exception.detail
598
+ )
599
+ except Exception as e:
600
+ global_object_square_logger.logger.error(e, exc_info=True)
601
+ """
602
+ rollback logic
603
+ """
604
+ # pass
605
+ output_content = get_api_output_in_standard_format(
606
+ message=messages["GENERIC_500"],
607
+ log=str(e),
608
+ )
609
+ return JSONResponse(
610
+ status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, content=output_content
611
+ )
612
+
613
+
614
+ @router.post("/reset_password_and_login_using_reset_email_code/v0")
615
+ @global_object_square_logger.auto_logger()
616
+ async def reset_password_and_login_using_reset_email_code_v0(
617
+ body: ResetPasswordAndLoginUsingResetEmailCodeV0,
618
+ ):
619
+ reset_email_code = body.reset_email_code
620
+ username = body.username
621
+ new_password = body.new_password
622
+ logout_other_sessions = body.logout_other_sessions
623
+ try:
624
+ """
625
+ validation
626
+ """
627
+ # pass
628
+ """
629
+ main process
630
+ """
631
+ response = global_object_square_authentication_helper.reset_password_and_login_using_reset_email_code_v0(
632
+ reset_email_code=reset_email_code,
633
+ username=username,
634
+ new_password=new_password,
635
+ app_id=global_int_app_id,
636
+ logout_other_sessions=logout_other_sessions,
637
+ )
638
+ """
639
+ return value
640
+ """
641
+
642
+ return JSONResponse(
643
+ status_code=status.HTTP_200_OK,
644
+ content=response,
645
+ )
646
+ except HTTPError as http_error:
647
+ global_object_square_logger.logger.error(http_error, exc_info=True)
648
+ """
649
+ rollback logic
650
+ """
651
+ # pass
652
+ return JSONResponse(
653
+ status_code=http_error.response.status_code,
654
+ content=json.loads(http_error.response.content),
655
+ )
656
+ except HTTPException as http_exception:
657
+ global_object_square_logger.logger.error(http_exception, exc_info=True)
658
+ """
659
+ rollback logic
660
+ """
661
+ # pass
662
+ return JSONResponse(
663
+ status_code=http_exception.status_code, content=http_exception.detail
664
+ )
665
+ except Exception as e:
666
+ global_object_square_logger.logger.error(e, exc_info=True)
667
+ """
668
+ rollback logic
669
+ """
670
+ # pass
671
+ output_content = get_api_output_in_standard_format(
672
+ message=messages["GENERIC_500"],
673
+ log=str(e),
674
+ )
675
+ return JSONResponse(
676
+ status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, content=output_content
677
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: square-administration
3
- Version: 3.2.2
3
+ Version: 3.3.0
4
4
  Summary: common business layer for my personal server.
5
5
  Home-page: https://github.com/thepmsquare/square_administration
6
6
  Author: thePmSquare
@@ -32,6 +32,13 @@ pip install square_administration
32
32
 
33
33
  ## changelog
34
34
 
35
+ ### v3.3.0
36
+
37
+ - authentication
38
+ - add new endpoint -> register_login_google_v0.
39
+ - add new endpoint -> reset_password_and_login_using_backup_code_v0.
40
+ - add new endpoint -> reset_password_and_login_using_reset_email_code_v0.
41
+
35
42
  ### v3.2.2
36
43
 
37
44
  - remove config.ini and config.testing.ini from version control.
@@ -1,4 +1,5 @@
1
1
  README.md
2
+ pyproject.toml
2
3
  setup.py
3
4
  square_administration/__init__.py
4
5
  square_administration/configuration.py
@@ -1,16 +0,0 @@
1
- from pydantic import BaseModel
2
-
3
-
4
- class RegisterUsernameV0(BaseModel):
5
- username: str
6
- password: str
7
- admin_password: str
8
-
9
-
10
- class LoginUsernameV0(BaseModel):
11
- username: str
12
- password: str
13
-
14
-
15
- class RemoveAppForSelfV0(BaseModel):
16
- password: str