Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to login with username/email and password in Habitica integration #117622

Merged
merged 16 commits into from
Aug 30, 2024

Conversation

tr4nt0r
Copy link
Contributor

@tr4nt0r tr4nt0r commented May 17, 2024

Reopened as new PR because I messed up when resolving merge conflicts.

Proposed change

The Config Flow for setting up the Habitica integration is now a lot more user-friendly. Users can now user their normal username/e-mail and password combination they also use to login to Habitica, instead having to handle with their User ID and API Token. The Config Flow then stores the User ID and API Token which are returned in the JSON response of the login endpoint.

Because Habitica is open source, users could want to connect to a different instance than the official Habitica, even to a self-hosted one. Therefore users can choose between "Login to Habitica" and an "Advanced Configuration". The Advanced Configuration still offers the same options as before, like using User ID and API Token and the URL to point to a different instance. Just an option to disable SSL verification was added, in case it is an instance with a self-signed certificate.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant
Copy link

Hey there @asmfreak, @leikoilja, mind taking a look at this pull request as it has been labeled with an integration (habitica) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of habitica can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign habitica Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@tr4nt0r tr4nt0r marked this pull request as ready for review May 17, 2024 09:14
Copy link
Contributor

@edenhaus edenhaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please rebase and fix the merge conflicts?

After that, I can start reviewing your PR

@home-assistant home-assistant bot marked this pull request as draft May 28, 2024 13:53
@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@tr4nt0r tr4nt0r force-pushed the habitica_config_flow branch from 3f4e0b7 to c5e6b26 Compare May 28, 2024 14:02
@tr4nt0r tr4nt0r marked this pull request as ready for review May 28, 2024 15:33
@home-assistant home-assistant bot requested a review from edenhaus May 28, 2024 15:33
@frenck frenck added the smash Indicator this PR is close to finish for merging or closing label Jun 20, 2024
@tr4nt0r tr4nt0r changed the title Make Habitica config flow more user-friendly Add option to login with username/email and password in Habitica integration Jun 24, 2024
@tr4nt0r tr4nt0r force-pushed the habitica_config_flow branch from 2ac0da8 to 720cb13 Compare July 2, 2024 03:28
@tr4nt0r tr4nt0r marked this pull request as draft July 20, 2024 16:56
@tr4nt0r tr4nt0r force-pushed the habitica_config_flow branch 3 times, most recently from 634fc2f to aeae1be Compare July 20, 2024 17:47
@tr4nt0r tr4nt0r marked this pull request as ready for review July 20, 2024 17:48
homeassistant/components/habitica/config_flow.py Outdated Show resolved Hide resolved
"api_user": "Habitica’s API user ID",
"api_key": "[%key:common::config_flow::data::api_key%]"
"api_user": "User ID",
"api_key": "API Token",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have a common key for this right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this because that is how it is called by Habitica.

Screenshot 2024-08-21 175559

@home-assistant home-assistant bot marked this pull request as draft August 21, 2024 12:58
@tr4nt0r tr4nt0r marked this pull request as ready for review August 21, 2024 16:10
@home-assistant home-assistant bot requested a review from joostlek August 21, 2024 16:10
@tr4nt0r tr4nt0r force-pushed the habitica_config_flow branch from 65d9d0a to 63a33c2 Compare August 23, 2024 19:16
Copy link
Member

@joostlek joostlek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a merge conflict

@home-assistant home-assistant bot marked this pull request as draft August 30, 2024 14:32
@tr4nt0r tr4nt0r force-pushed the habitica_config_flow branch from 63a33c2 to b086010 Compare August 30, 2024 15:00
@tr4nt0r tr4nt0r marked this pull request as ready for review August 30, 2024 15:06
@home-assistant home-assistant bot requested a review from joostlek August 30, 2024 15:06
@joostlek joostlek merged commit 5057788 into home-assistant:dev Aug 30, 2024
26 checks passed
@tr4nt0r tr4nt0r deleted the habitica_config_flow branch August 30, 2024 15:12
synesthesiam pushed a commit that referenced this pull request Aug 30, 2024
…gration (#117622)

* add login/password authentication

* add advanced config flow

* remove unused exception classes, fix errors

* update username in init

* update tests

* update strings

* combine steps with menu

* remove username from entry

* update tests

* Revert "update tests"

This reverts commit 6ac8ad6.

* Revert "remove username from entry"

This reverts commit d9323fb.

* small changes

* remove pylint broad-excep

* run habitipy init in executor

* Add text selectors

* changes
@github-actions github-actions bot locked and limited conversation to collaborators Aug 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants