UserManagementNotificationBusBehaviorHandler.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <UserManagement/AWSCognitoUserManagementBus.h>
  10. #include <AzCore/Component/TickBus.h>
  11. namespace AWSClientAuth
  12. {
  13. //! User management behavior EBus handler
  14. class UserManagementNotificationBusBehaviorHandler
  15. : public AWSCognitoUserManagementNotificationBus::Handler
  16. , public AZ::BehaviorEBusHandler
  17. {
  18. public:
  19. AZ_EBUS_BEHAVIOR_BINDER(UserManagementNotificationBusBehaviorHandler, "{57289595-2CDC-4834-8017-4A96B983E028}", AZ::SystemAllocator,
  20. OnEmailSignUpSuccess, OnEmailSignUpFail,
  21. OnPhoneSignUpSuccess, OnPhoneSignUpFail,
  22. OnConfirmSignUpSuccess, OnConfirmSignUpFail,
  23. OnForgotPasswordSuccess, OnForgotPasswordFail,
  24. OnConfirmForgotPasswordSuccess, OnConfirmForgotPasswordFail,
  25. OnEnableMFASuccess, OnEnableMFAFail
  26. );
  27. void OnEmailSignUpSuccess(const AZStd::string& uuid) override
  28. {
  29. AZ::TickBus::QueueFunction([uuid, this]() {
  30. Call(FN_OnEmailSignUpSuccess, uuid);
  31. });
  32. }
  33. void OnEmailSignUpFail(const AZStd::string& error) override
  34. {
  35. AZ::TickBus::QueueFunction([error, this]() {
  36. Call(FN_OnEmailSignUpFail, error);
  37. });
  38. }
  39. void OnPhoneSignUpSuccess(const AZStd::string& uuid) override
  40. {
  41. AZ::TickBus::QueueFunction([uuid, this]() {
  42. Call(FN_OnPhoneSignUpSuccess, uuid);
  43. });
  44. }
  45. void OnPhoneSignUpFail(const AZStd::string& error) override
  46. {
  47. AZ::TickBus::QueueFunction([error, this]() {
  48. Call(FN_OnPhoneSignUpFail, error);
  49. });
  50. }
  51. void OnConfirmSignUpSuccess() override
  52. {
  53. AZ::TickBus::QueueFunction([this]() {
  54. Call(FN_OnConfirmSignUpSuccess);
  55. });
  56. }
  57. void OnConfirmSignUpFail(const AZStd::string& error) override
  58. {
  59. AZ::TickBus::QueueFunction([error, this]() {
  60. Call(FN_OnConfirmSignUpFail, error);
  61. });
  62. }
  63. void OnForgotPasswordSuccess() override
  64. {
  65. AZ::TickBus::QueueFunction([this]() {
  66. Call(FN_OnForgotPasswordSuccess);
  67. });
  68. }
  69. void OnForgotPasswordFail(const AZStd::string& error) override
  70. {
  71. AZ::TickBus::QueueFunction([error, this]() {
  72. Call(FN_OnForgotPasswordFail, error);
  73. });
  74. }
  75. void OnConfirmForgotPasswordSuccess() override
  76. {
  77. AZ::TickBus::QueueFunction([this]() {
  78. Call(FN_OnConfirmForgotPasswordSuccess);
  79. });
  80. }
  81. void OnConfirmForgotPasswordFail(const AZStd::string& error) override
  82. {
  83. AZ::TickBus::QueueFunction([error, this]() {
  84. Call(FN_OnConfirmForgotPasswordFail, error);
  85. });
  86. }
  87. void OnEnableMFASuccess() override
  88. {
  89. AZ::TickBus::QueueFunction([this]() {
  90. Call(FN_OnEnableMFASuccess);
  91. });
  92. }
  93. void OnEnableMFAFail(const AZStd::string& error) override
  94. {
  95. AZ::TickBus::QueueFunction([error, this]() {
  96. Call(FN_OnEnableMFAFail, error);
  97. });
  98. }
  99. };
  100. } // namespace AWSClientAuth