Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sh00t2kill/dolphin-robot
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.16b1
Choose a base ref
...
head repository: sh00t2kill/dolphin-robot
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.0.16b2
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Jul 6, 2024

  1. add is email exists before reset password

    elad-bar committed Jul 6, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    0e3c1f9 View commit details
  2. Merge pull request #215 from sh00t2kill/email-validation

    add is email exists before reset password
    elad-bar authored Jul 6, 2024
    Copy the full SHA
    8daaf6f View commit details
Showing with 16 additions and 13 deletions.
  1. +16 −13 custom_components/mydolphin_plus/managers/rest_api.py
29 changes: 16 additions & 13 deletions custom_components/mydolphin_plus/managers/rest_api.py
Original file line number Diff line number Diff line change
@@ -253,25 +253,28 @@ async def reset_password(self):
if self._session is None:
await self._initialize_session()

username = self.config_data.username
is_valid_email = await self._email_validation()

request_data = f"{API_REQUEST_SERIAL_EMAIL}={username}"

payload = await self._async_post(
FORGOT_PASSWORD_URL, LOGIN_HEADERS, request_data
)
if is_valid_email:
username = self.config_data.username

if payload is None:
_LOGGER.error("Empty response of reset password")
request_data = f"{API_REQUEST_SERIAL_EMAIL}={username}"

else:
data = payload.get(API_RESPONSE_DATA)
payload = await self._async_post(
FORGOT_PASSWORD_URL, LOGIN_HEADERS, request_data
)

if data is None:
_LOGGER.error("Empty response payload of reset password")
if payload is None:
_LOGGER.error("Empty response of reset password")

else:
_LOGGER.info(f"Reset password response: {data}")
data = payload.get(API_RESPONSE_DATA)

if data is None:
_LOGGER.error("Empty response payload of reset password")

else:
_LOGGER.info(f"Reset password response: {data}")

async def _email_validation(self) -> bool:
_LOGGER.debug("Validating account email")