Commit Graph

43874 Commits

Author SHA1 Message Date
Mateusz Mandera 86c330b752 social_auth: Fix handling of user errors in the authentication process.
The code didn't account for existence of SOCIAL_AUTH_SUBDOMAIN. So the
redirects would happen to endpoints on the SOCIAL_AUTH_SUBDOMAIN, which
is incorrect. The redirects should happen to the realm from which the
user came.
2021-07-24 15:17:52 -07:00
Mateusz Mandera 388932bcc4 docs: Move docs on SOCIAL_AUTH_OIDC_FULL_NAME_VALIDATED to ReadTheDocs. 2021-07-24 15:16:13 -07:00
Mateusz Mandera 9bf84a35ef docs: Mention auto_signup OIDC option in ReadTheDocs documentation. 2021-07-24 15:13:47 -07:00
Mateusz Mandera 0d6b1cd08b docs: Tweak phrasing about OIDC supporting only a single provider.
Strictly speaking, this sentence is talking about the IdP configuration,
while the backend is just GenericOpenIdConnectBackend, so the new
phrasing is more correct.
2021-07-24 15:12:06 -07:00
PIG208 5359d20a13 webhooks: Add support to event filtering system for webhooks.
This add support to event filtering system for most webhooks that
require trivial changes to adapt this feature.
2021-07-24 15:10:09 -07:00
PIG208 987f859681 webhooks: Detect view function with default naming convention. 2021-07-24 15:10:09 -07:00
PIG208 66b1a4e7ca backend: Add None-checks with assertions and if-elses.
This fixes a batch of mypy errors of the following format:
'Item "None" of "Optional[Something]" has no attribute "abc"'
2021-07-24 15:00:21 -07:00
PIG208 fffd4ed8d5 invitations: Correctly compare realms for revoke_user_invite. 2021-07-24 14:59:19 -07:00
PIG208 de2678a319 tests: Fix missed mypy errors in tests.
This fixes a batch of mypy errors of the following format:
'Item "None" of "Optional[Something]" has no attribute "abc"
as a follow-up for 9892951703.
2021-07-24 14:59:19 -07:00
Tim Abbott 01ce58319d mypy: Fix most AnonymousUser type errors.
This commit fixes several mypy errors with Django stubs, by telling
mypy that we know in a given code path that the user is authenticated.
2021-07-24 14:55:46 -07:00
Tim Abbott 4713f78d2e mypy: Add various type-checking assertions in authentication backends. 2021-07-24 13:06:55 -07:00
Tim Abbott c576f0c93f mypy: Declare type for OIDC settings dictionaries. 2021-07-24 12:55:15 -07:00
Tim Abbott d603b0641e mypy: Extend type for post_data in send_to_push_bouncer. 2021-07-24 12:55:15 -07:00
Tim Abbott bd134019e4 mypy: Fix return type for num_push_devices_for_user. 2021-07-24 12:55:15 -07:00
Tim Abbott 4aba6c9833 mypy: Use Sequence in push notifications types.
This is important for variance reasons.
2021-07-24 12:55:15 -07:00
Tim Abbott 6e26c8912e actions: Fix stream_dict/sub_dict types and variable names. 2021-07-24 11:02:08 -07:00
Tim Abbott 3790146c75 actions: Fix typing for raw stream dictionaries. 2021-07-24 11:02:08 -07:00
PIG208 495a8476be tests: Use assertion to enforce None-checks in tests.
This fixes a batch of mypy errors of the following format:
'Item "None" of "Optional[Something]" has no attribute "abc"

Since we have already been recklessly using these attritbutes
in the tests, adding assertions beforehand is justified presuming
that they oughtn't to be None.
2021-07-24 09:54:21 -07:00
PIG208 442adfaff3 sessions: Use SessionBase instead of Session. 2021-07-24 09:54:21 -07:00
Ganesh Pawar cc6aad75c6 widgets: Margin-left for the box-shadow to be visible on the left. 2021-07-24 09:52:14 -07:00
Ganesh Pawar 43a3a73a0d widgets: Avoid adding the widget_elem if it already exists.
Fixes #18631
2021-07-24 09:52:14 -07:00
Tim Abbott ab2ef76baa login: Fix hash being lost with redirects.
This fixes the following flow being broken:

* You start on
  http://zulipdev.com:9991/accounts/go/?next=/upgrade%23sponsorship
  (which we link to from e.g. /plans/)

* The form on that page has
  `action=/accounts/go/?next=%2Fupgrade%23sponsorship`, i.e. it has correctly
  URL-encoded the `next `value.

* You enter a realm name and hit submit.

* That redirects you to
  `http://realm-26.zulipdev.com:9991/upgrade#sponsorship`, would is
  correct if you are already logged in.

* However, if you're not logged in, `/upgrade` will serve a redirect
  to the login page, landing you at
  `http://realm-26.zulipdev.com:9991/devlogin/?next=/upgrade/#sponsorship`.
  This page works.  But in production, it would instead be:
  `http://realm-26.zulipdev.com:9991/login/?next=/upgrade/#sponsorship`.
  On this page, password login works but social login does not.
  Note that the `next=` value is no longer URL-encoded, and thus is
  parsed by the browser as `?next=/upgrade` + a hash of
  `#sponsorship`.

* If you now login with Google auth, you find yourself on
  `http://realm-26.zulipdev.com:9991/#sponsorship` (no /upgrade).

The root cause was that we have a bit of JavaScript in signup.js and
dev-login.js that is intended to handle this; but it was broken for
the social login case for unknown legacy reasons.

This bug appears to date from the original
b62bdde303 which introduced `next`
support for social backends in the first place.
2021-07-24 09:50:15 -07:00
Gaurav Pandey 7f0dd81ada
api: Bump feature level to 82.
Bump api feature level to 82 after changes in 5db4fe8652.
2021-07-24 09:48:47 -07:00
Tim Abbott fdf21c89db portico: Fix missing image on /for/research mobile view. 2021-07-23 23:33:44 -07:00
Tim Abbott 6421146ff5 templates: Delete removed /for/research.md.
We reworked the HTML page that included it to no longer need this.
2021-07-23 23:33:28 -07:00
Tim Abbott 97370154eb templates: Fix duplicate content from rebase error. 2021-07-23 23:25:58 -07:00
Tim Abbott 71abf8c812 plans: Use black font for first line of pricing details.
This helps the user visually focus on the less fine print text.
2021-07-23 22:49:54 -07:00
Tim Abbott 2df8c0d796 portico: Fix responsive mobile size screenshots. 2021-07-23 22:47:58 -07:00
Vishnu KS 158cec84ec stripe: Upgrade stripe API to 2020-08-27 version.
This upgrades the Stripe API to the most recent version. Going through
the Git history, it looks like our current API version is at 2019-03-14.

The API version should be manually changed in Stripe dashboard at the same
time as the commit is deployed in production.

Backward incompatible changes that are relevant to our codebase between
(2019-03-14, 2020-08-27].
* 2020-08-27 - The `sources` property on Customers is no longer included by
  default.
* 2020-03-02 - Nothing applicable
* 2019-12-03 - The `id` field of all invoice line items have changed and are
  now prefixed
  with `il_`. We only rely on this while we normalize the fixtures.
* 2019-11-05 - Nothing applicable
* 2019-10-17 - The `billing` attribute on invoices, subscriptions, and
  subscription schedules is renamed to`collection_method`. The invoice
  change is the one that is relevant to us.
* The customer object’s `account_balance` value has been renamed to
  `balance`. Only used for the stubs at the moment.
* 2019-10-08 - Nothing applicable
* 2019-09-09 - Nothing applicable
* 2019-08-14 - Nothing applicable
* 2019-05-16 - Nothing applicable

https://stripe.com/docs/upgrades

Also normalize the following IDs in stripe fixtures

* price_[A-Za-z0-9]{24}
* prod_[A-Za-z0-9]{14}
* pi_[A-Za-z0-9]{24}
* il_[A-Za-z0-9]{24}
2021-07-23 21:44:41 -07:00
Tim Abbott 4b6e2c4e4d plans: Explain annual billing model more clearly. 2021-07-23 21:31:31 -07:00
Alya Abbott 8a168ec277 portico: Fix copy-paste bug on /for/research. 2021-07-23 18:17:45 -07:00
Alya Abbott cb82ea2ed8 portico: Add general info at the top of /for/x pages. 2021-07-23 18:17:44 -07:00
Eeshan Garg 09e6ac79dd landing_pages: Add screenshots for /for/events and /for/research.
This commit adds more specific screenshots to our events and
research pages. The newer screenshots are properly sized such that
they fit well in a 400px width.

We also move a quote to improve the visual design.
2021-07-23 14:07:14 -07:00
Eeshan Garg a4dbb30543 for_education: Add better screenshots with proper size.
The screenshots we have currently don't really fit into the width
available and the font looks too small. This commit adds newer
screenshots that have been scaled to fit a width of 400px such that
the font is readable with a small amount of content.
2021-07-23 14:03:41 -07:00
Tim Abbott 61a9229dba user_status: Fix test import order to pass lint. 2021-07-23 13:25:39 -07:00
Tim Abbott 12737fdc02 models: Add models for emoji in user statuses. 2021-07-23 13:11:21 -07:00
Riken Shah 67f4851ded user_status: Add `get_emoji_info` function.
This is a prep commit to add the status emoji feature.

This function will add missing/extra parameters to the
emoji info object, that would need by the template to
render an emoji.

Co-authored-by: Yash Rathore <33805964+YashRE42@users.noreply.github.com>
2021-07-23 13:03:32 -07:00
Riken Shah b7b18cdfd3 emoji_picker: Update architecture to support status emoji.
This is a prep commit to add the status emoji feature.

We update the templates associated with the emoji
picker to add class `status_emoji` to `emoji` in the
popover.  So we can later add the events when the user
selects the emoji.

We also update the functions in `emoji_picker.js` to
support opening emoji picker popover in the 'set_status_
overlay`.

We also increase the `z-index` of the `popover-flex`
class (This class is only added to popover-emoji content
if the view is mobile), so in the mobile view the emoji
popover doesn't go behind the '#set_user_status_modal'.
2021-07-23 13:03:13 -07:00
Riken Shah 98710d67a2 refactor: Rename Set a status message/Edit status message button text.
In this commit,

* We rename `Set a status message` to `Set a status`
and
* We rename `Edit status message` to `Edit status`

for more clarity.
2021-07-23 12:57:51 -07:00
Alya Abbott 7df9374321 portico: Add Zoe. 2021-07-23 12:50:28 -07:00
manavdesai27 9cebd1ec80 markdown: Fixed hr visibility in day theme.
Tweaked by tabbott to use a simpler approach proposed by the author in
the PR.
2021-07-23 12:48:43 -07:00
Hemanth V. Alluri b5cd232a2e drafts: Use enable_drafts_synchronization for access control.
If a user doesn't have enable_drafts_synchronization set to True, then
don't let them access the drafts API.  This will help protect us
against client bugs accidentally sending drafts to the server when the
feature is disabled.

Signed-off-by: Hemanth V. Alluri <hdrive1999@gmail.com>
2021-07-23 12:34:15 -07:00
Hemanth V. Alluri 08e9e48205 models: Add a new field controlling drafts synchronization.
This field will control whether or not a user wants to sync their
drafts between different clients.  Defaults to enabled.

Signed-off-by: Hemanth V. Alluri <hdrive1999@gmail.com>
2021-07-23 12:31:00 -07:00
Alya Abbott 448b38835a portico: Minor tweaks to top and bottom of case studies. 2021-07-23 12:25:03 -07:00
Aman Agrawal e977f42819 case-studies: Add links back to /for/education page.
Transfer case study title to hero image.
Used the same education background for image.
2021-07-23 12:25:03 -07:00
Abhijeet Prasad Bodas 5db4fe8652 api: Allow setting email_notifications_batching_period_seconds.
We allow a maximum value of one week to make sure there aren't a huge
number of rows in the table for any user (this could happen if stream
notifications are enabled).

This commit also fixes a small error in the user_settings test.
2021-07-23 12:22:05 -07:00
Abhijeet Prasad Bodas dd5e12d112 MissedMessageWorker: Use custom batching periods from UserProfile. 2021-07-23 12:13:46 -07:00
Abhijeet Prasad Bodas d5d3f14eee models: Add UserProfile field for custom email notifs batching periods.
The default is 2 minutes (120 seconds), which was the hardcoded value
earlier.
2021-07-23 12:13:46 -07:00
Abhijeet Prasad Bodas 9fcb6e51ce MissedMessageWorker: Handle deleted messages.
The test for the try-except block is hacky. See the comment for
explaination.
2021-07-23 12:13:46 -07:00
Abhijeet Prasad Bodas de78b015d9 MissedMessageWorker: Remove unnecessary transaction.atomic.
We only have one query which will change database state in this function,
and we already have a lock on the process itself, so there's no need for
a transaction.

This was added in ebb4eab0f9.
2021-07-23 12:13:46 -07:00