khoj-ai / khoj

Your AI second brain. Self-hostable. Get answers from the web or your docs. Build custom agents, schedule automations, do deep research. Turn any online or local LLM into your personal, autonomous AI (e.g gpt, claude, gemini, llama, qwen, mistral).
https://khoj.dev
GNU Affero General Public License v3.0
14.22k stars 705 forks source link

Fix null exception when user does not exist for subscription #577

Closed sabaimran closed 11 months ago

sabaimran commented 11 months ago

If a user subscribes to Khoj with an email address that's not present in the DB, create an account with the corresponding email address and then update the Subscription object.

Bear in mind that this flow will cause some hiccups for users whose email addresses are not associated with Google accounts. So when they try to log in, their account may not be associated with their subscription. We should find better workarounds to avoid this.

debanjum commented 11 months ago

To reduce chances of users paying via a non-supported email account is to link to https://app.khoj.dev/config?#billing from the https://khoj.dev/pricing page

  1. This would require users to create their account via a supported email account on khoj.dev before trying to pay
  2. The email address associated with their payment by default will be set to their Khoj associated email account

But for that to work, we need to fix post-login redirects on app.khoj.dev. Created #578 to track that as a separate issue to fix