Commit Graph

133 Commits

Author SHA1 Message Date
Umair Khan 5359e6b0d4 Convert Zulip to use Jinja2 templates.
This results in a substantial performance improvement for all of
Zulip's backend templates.

Changes in templates:
- Change `block.super` to `super()`.
- Remove `load` tag because Jinja2 doesn't support it.
- Use `minified_js()|safe` instead of `{% minified_js %}`.
- Use `compressed_css()|safe` instead of `{% compressed_css %}`.
- `forloop.first` -> `loop.first`.
- Use `{{ csrf_input }}` instead of `{% csrf_token %}`.
- Use `{# ... #}` instead of `{% comment %}`.
- Use `url()` instead of `{% url %}`.
- Use `_()` instead of `{% trans %}` because in Jinja `trans` is a block tag.
- Use `{% trans %}` instead of `{% blocktrans %}`.
- Use `{% raw %}` instead of `{% verbatim %}`.

Changes in tools:
- Check for `trans` block in `check-templates` instead of `blocktrans`

Changes in backend:
- Create custom `render_to_response` function which takes `request` objects
  instead of `RequestContext` object. There are two reasons to do this:
    1. `RequestContext` is not compatible with Jinja2
    2. `RequestContext` in `render_to_response` is deprecated.
- Add Jinja2 related support files in zproject/jinja2 directory. It
  includes a custom backend and a template renderer, compressors for js
  and css and Jinja2 environment handler.
- Enable `slugify` and `pluralize` filters in Jinja2 environment.

Fixes #620.
2016-05-09 09:55:18 -07:00
Tim Abbott 89d9060aab Add logging for failures in password reset form.
This may be useful for monitoring abuse issues.
2016-04-28 14:28:09 -07:00
Tim Abbott a0430c02ce Allow users who haven't set a password to set one.
Previously, if a user had only authenticated via Google auth, they
would be unable to reset their password in order to set one (which is
needed to setup the mobile apps, for example).
2016-04-28 14:27:43 -07:00
Tim Abbott c661bc17fb Fix support for having a unique, open realm.
The previous implementation didn't work because HomepageForm rejected
the email as not having a domain.  Additionally, the logic in
accounts_register didn't work with Google auth because that code path
doesn't pass through accounts_home.  Since whether there's a unique
open realm for the server is effectively a configuration property, we
can fix the bug and make the logic clearer by moving it into the
"figure out the user's realm" function.
2016-01-09 22:52:34 -08:00
Tim Abbott e9243d0f0b Apply Python 3 futurize transform lib2to3.fixes.fix_has_key. 2015-11-01 08:10:01 -08:00
Tim Abbott 8c34c40924 Apply Python 3 futurize transform lib2to3.fixes.fix_except. 2015-11-01 08:08:33 -08:00
Tim Abbott 494797ea0a Fix has_valid_realm logic following get_realm refactor. 2015-10-19 09:59:06 -07:00
Tim Abbott 3e1f4e611c Clarify on zulip.com signup form that we're not taking new teams. 2015-10-19 09:37:24 -07:00
Tim Abbott 71a06d58de Convert uses of Realm.objects.get() to get_realm().
get_realm is better in two key ways:
* It uses memcached to fetch the data from the cache and thus is faster.
* It does a case-insensitive query and thus is more safe.
2015-10-15 09:16:58 -04:00
Tim Abbott bda9d78092 Use settings.ZULIP_ADMINISTRATOR as contact list for deactivated users. 2015-09-29 17:59:47 -07:00
Waseem Daher 6bb9b129f7 Update Zulip support email to zulip-devel@googlegroups.com.
Ideally some of these templates should really point to the
local installation's support email address, but this is a
good start.

Exceptions:
* Where to report security incidents
* MIT Zephyr-related pages
* zulip.com terms and conditions
2015-09-29 17:59:47 -07:00
David Roe edf7e732a2 ENTERPRISE => VOYAGER.
(imported from commit 4f8080b9f506a87ca40bef32e39de5218cba916a)
2015-08-21 10:33:35 -07:00
David Roe 472898cfc6 Allow adding users to realms more easily in Dev VM.
Include new field on Realm to control whether e-mail invitations are required
separately from whether the e-mail domain must match.
Allow control of these fields from admin panel.
Update logic in registration page to use these fields.

(imported from commit edc7f0a4c43b57361d9349e258ad4f217b426f88)
2015-08-19 22:24:53 -07:00
Zev Benjamin 2e1d5ffd1c Make password_auth_enabled() take a realm object
This will actually be used in an upcoming commit.

(imported from commit 5d3db685a245899b2523440398f2ed2f0cfec4f4)
2014-04-04 16:51:32 -07:00
Tim Abbott 4bf3ace444 [manual] Allow signups for emails held by non-MIT mirror dummy accounts.
Before this is deployed to prod, we need to manually frob our database
to set the is_mirror_dummy=True bit for all existing mirror users.

(imported from commit 39f1938cef091cf1d7d97307f76b137fe1d92b6c)
2014-01-10 21:38:59 -05:00
Tim Abbott 2c87cb5101 Fix OurAuthenticationForm return value for invalid accounts.
(imported from commit 10461554bec5d86d2ab768177762f11cd905e0f3)
2014-01-09 11:08:41 -05:00
Jessica McKellar 0e120c9bbf Show users in deactivated realms an error page when they try to log in.
(imported from commit 6de839ae944b8c76715361c2211cd759d78f4f1a)
2014-01-07 20:24:21 -05:00
Tim Abbott 6721c465c9 Add admin API endpoint for creating users.
(imported from commit a8b919c7d21b28dfd75b6b95736a375874ead15f)
2013-12-10 13:21:33 -05:00
Leo Franchi 501f063426 Replace email_to_domain with split_email_to_domain and resolve_email_to_domain
Now that we support email aliases, we have to be careful when going from
an email address to a domain that we assume we can use to get a Realm
object for. When we care about the Realm's domain, we want to follow
any RealmAliases that exist for a certain domain.

When we just care about the original email address domain itself,
for comparison or other purposes, use split_email_from_domain

This removes the ambiguity of having to decide when to use
email_to_domain + RealmAlias or just email_to_domain

(imported from commit 0e199495502d946ce2e1aae56263e7e8665be4ed)
2013-11-26 10:45:01 -05:00
Tim Abbott 4116e06c88 Disable signups for realms that exist as part of enterprise deployments.
(imported from commit 4200b44c7153d1dba674982916ef0470c75bdf6d)
2013-11-15 19:36:17 -05:00
Kevin Mehall 53c76aa657 Move enterprise-registration to zilencer/ from zerver/
(imported from commit d8a58913040376dbdbc9dcee13ab8a7910733da7)
2013-11-15 11:21:52 -05:00
Luke Faraone 4b8a770825 Don't prompt for a password if password auth is disabled
(imported from commit d696c9f6de2008c177fa3282383257de15aaeb29)
2013-11-13 17:57:33 -05:00
Luke Faraone d19ffd67a7 Don't make enterprise users agree to the ToS
(imported from commit 2d01de949210a14edb5bef949d59a8495136ecac)
2013-11-13 17:57:32 -05:00
Jessica McKellar 76e1c80ac5 Add an enterprise registration page.
(imported from commit 5888f588ad219ba25b235477a7137853e5954bb5)
2013-11-13 16:20:42 -05:00
Leo Franchi 62ba16a829 [schema] Allow a realm to have aliases for multiple other domains
(imported from commit 5d0340afd4c77f50db63550a3ec8d81e885c285c)
2013-11-13 14:17:43 -05:00
Tim Abbott 68dcc760c3 Clean up some unused imports.
(imported from commit 0c5d8e2a55ba1b8909ba807fee3afe863dcdc226)
2013-11-04 11:51:17 -05:00
Waseem Daher 190390d8ea Allow MIT to invite coworkers.
(imported from commit 273b3abdd3dcc49c01c1a04001450983d4acb000)
2013-09-19 17:14:41 -04:00
Luke Faraone 0cb741d7cc Removed confusing ALLOW_REGISTER setting.
ALLOW_REGISTER was no longer being used in determining whether you could
register for the app, so I've removed it to avoid additional local-dev /
production issues.

This closes #1613.

(imported from commit c928c6d350602d35f745ae1e60d734e4567885fc)
2013-08-12 16:16:26 -04:00
Luke Faraone f3c8806d30 Allow open realm signups with non-real-user MIT addresses.
This allows me to use a mail alias with CUSTOMER3, and closes #1671.

(imported from commit 581d1145fb112b9d35ad522fa06f81a25b4b8d3b)
2013-08-12 16:16:24 -04:00
Luke Faraone cb2e993393 Allow any user with a @mit.edu to register for Zulip.
We add a new validator that ensures that people who sign up with @mit.edu
addresses are in fact MIT users.

This closes #1612.

(imported from commit 1e30794b1615dd57cb0e367d1fa186a877253357)
2013-08-12 13:09:20 -07:00
Jessica McKellar d6c87f35e2 Move domain validation from a form field validator to a data cleaning check.
We need to be able to let a user through if they are trying to sign up
for a completely open realm like CUSTOMER3.

(imported from commit 1e33ab0ce94545f217739d501e9227dfb48e1123)
2013-08-08 10:12:22 -04:00
Tim Abbott 7b9305b06f Rename Django project to zproject.
This includes a hack to preserve humbug/backends.py as a symlink, so
that we don't need to regenerate all our old sessions.

(imported from commit b7918988b31c71ec01bbdc270db7017d4069221d)
2013-08-07 11:04:03 -04:00
Tim Abbott e111a2f9a5 [manual] Rename Django app from zephyr to zerver.
This needs to be deployed to both staging and prod at the same
off-peak time (and the schema migration run).

At the time it is deployed, we need to make a few changes directly in
the database:

(1) UPDATE django_content_type set app_label='zerver' where app_label='zephyr';
(2) UPDATE south_migrationhistory set app_name='zerver' where app_name='zephyr';

(imported from commit eb3fd719571740189514ef0b884738cb30df1320)
2013-08-06 07:39:36 -04:00