Commit Graph

62 Commits

Author SHA1 Message Date
Tim Abbott 8ffd91a6ee Move new user/class creation into their own functions.
(imported from commit 192533c4e2bc55a26e7ea70a32e7d1f64d2ed8c3)
2012-09-27 15:01:30 -04:00
Keegan McAllister d38d575c41 Markdown: disable "safe mode"
We're already escaping HTML input.

(imported from commit 02b5f1033d102a5cb3df89577ec0445202ce7071)
2012-09-27 12:31:09 -04:00
Keegan McAllister 21d55c152f get_updates_longpoll: Send at most 400 messages at a time
Give the user some messages right away; keep their browser looking active and
responsive.

(imported from commit 435dda62aa47a16114431ae7b19aa92e005d699d)
2012-09-26 17:53:06 -04:00
Tim Abbott 9180f6d381 Remove unicode debugging prints.
(imported from commit 111a7e4c78537d4986c8b43c319d3c560f3cecb6)
2012-09-26 17:30:35 -04:00
Keegan McAllister 911f4306db Optimize get_updates_longpoll in the same manner as 805a944
(imported from commit 819826d34ef6a0adbf619d4bf5e740c1838c896c)
2012-09-26 17:23:18 -04:00
Tim Abbott 5e318bc961 More unicode debugging.
(imported from commit 9ec3ca2a6c3812055ace4b7c2a3348bb586e8696)
2012-09-26 17:08:13 -04:00
Tim Abbott 4458c8f3d7 Fix unicode issues.
(imported from commit 542dc67a3d2e2d44ef212354b38e4f8212ddef64)
2012-09-26 16:46:32 -04:00
Waseem Daher 8ef40a9654 Experiment: Restore gravatars (this time with real addr).
(imported from commit 0e1cc56286264c939864ac8b398f206e27d56841)
2012-09-26 16:34:24 -04:00
Tim Abbott df01b016cb Display short_names rather than email addresses for huddles.
(imported from commit 6509305f1b0ee90cfe5c93c74e03350a557a0cc5)
2012-09-26 15:32:35 -04:00
Tim Abbott c8220ee057 Don't store the post-markdown HTML in our database content column.
(imported from commit bb81e84acc04ea0930be1026149618fbb60174fd)
2012-09-26 14:51:14 -04:00
Tim Abbott 293c8dcff8 Fix recent display recipient change.
(imported from commit d0f7e7313437a510150f941b0464c972b34a8847)
2012-09-26 13:30:06 -04:00
Tim Abbott d374312509 Use email address for huddle display recipients.
This fixes replying to huddle messages.

(imported from commit 8e6f9ce7d690c926b19c50016ec972d767428994)
2012-09-26 13:24:08 -04:00
Tim Abbott f929593263 Don't try to use in-memory storage on model objects.
It doesn't work.

(imported from commit d5f95c345061e63b12fa12f2a0219f8e3b2e0380)
2012-09-26 10:44:47 -04:00
Tim Abbott 11e5e8785d Preparation for syncing messages back to MIT.
(imported from commit 551b697366702de93579de259a9bc644be8d66ec)
2012-09-24 14:31:40 -04:00
Tim Abbott 919ddfdc31 Send recipient_id values to client and track them there.
(imported from commit 77446f7a226d8a26a287e069d08f28e4beb0b2e3)
2012-09-21 16:57:04 -04:00
Keegan McAllister 85abb3f274 forge_zephyr: Convert email to lowercase
This fixes failing User.object.get(email=...)

(imported from commit e0d5097520c6a149031e6881ae25f4c5bb967918)
2012-09-21 14:11:34 -04:00
Keegan McAllister a68a3e7ab7 Get the just-created user from create_user
(imported from commit d709c99cc670aa1b0864c40b8c0d5e52b6c90340)
2012-09-21 14:01:43 -04:00
Keegan McAllister 08345098db Use truncated Base32 SHA256 instead of hex MD5 for usernames
There isn't a specific problem with using MD5 here, but there's just no reason
to use a hash function with serious known flaws.

We have to truncate to 30 characters for Django's username field.  Using Base32
instead of hex gives us twice as many bits.  This reduces the chances of a
collision (which are pretty low already) and also provides resistance against a
targetted attack based on some weakness in SHA256.  (There are better ways to
reduce a hash to fewer bits but let's not get too fancy.)

We still need to use MD5 for Gravatar because that's their protocol.

(imported from commit ffe6955312f580676409d4f9c4ed2d7f3d0df62c)
2012-09-21 13:44:13 -04:00
Keegan McAllister 3cbc56a866 Rename MD5_SALT to HASH_SALT
(imported from commit 3112cd805614c3057a9eb8f1b251381f48ab3173)
2012-09-21 13:44:09 -04:00
Tim Abbott 2d6683f896 Deduplicate user creation code.
(imported from commit bda76a9a44bd5ed7f0726b527fdb93cec109cbed)
2012-09-21 10:45:00 -04:00
Tim Abbott 135c82717d Authenticate by email.
Approach from http://www.micahcarrick.com/django-email-authentication.html.

(imported from commit 796b8e08d8e1f9769cd3cf8ee61d3724ac3847b7)
2012-09-21 10:34:48 -04:00
Tim Abbott ee8f28a084 Use email addresses as unique identifiers rather than usernames.
Note that this code still assumes one's email address (stripped of
domain) is unique.

(imported from commit e98f96601ad109811978fc00b1165e97d8f7b185)
2012-09-21 09:43:22 -04:00
Luke Faraone eb1740e1e7 Use emails in the gravatar seed, don't display a static gravatar for the current user.
(imported from commit 64d1fd4f1cd33796bc907fef9778e088d80b8c5a)
2012-09-19 13:39:34 -04:00
Keegan McAllister db7a8277ff Replace create_{user_profile,zephyr_class} with {UserProfile,ZephyrClass}.create
Looks nicer and cuts down on imports.

(imported from commit 4fdbbb45cf6d8ad016481c663cf52fd555b41d91)
2012-09-19 13:01:58 -04:00
Keegan McAllister 5486e148e3 Cache Zephyr.to_dict
(imported from commit 7968244a813111e328fc91c34d64af727a98bb36)
2012-09-19 13:01:58 -04:00
Tim Abbott d0b36d506b models: Add database index hints.
(imported from commit 96b94b943aa8cd04c26295af797b8ed9c40f5859)
2012-09-17 11:37:14 -04:00
Tim Abbott 0b699be7eb Add some caching of userprofile objects.
(imported from commit dd8e1bec2d677e873d90806aa71519c3a37221c8)
2012-09-17 11:37:11 -04:00
Tim Abbott a3aa83801a [schema] Use a TextField for the content data.
(imported from commit 83765da990ad94233978d24bea90cce8cc66f17b)
2012-09-14 13:32:25 -04:00
Keegan McAllister ae5137b5c9 Show timestamps on zephyrs
We use the browser's local timezone.

(imported from commit 6ed6444df6edf2093b9399adb1511dd3ee80def3)
2012-09-12 17:00:02 -04:00
Jessica McKellar f52ec24926 For now, compose zephyrs to usernames.
We'll eventually need to normalize emails, autocompleted names,
etc. to one entity we use when talking to the server about senders and
personals recipients, but for now since we've hardcoded usernames
everywhere, just use those.

(imported from commit 4a0e033b301b8dec55d97157eb4993982f6b2641)
2012-09-11 16:35:01 -04:00
Jessica McKellar bfdf2bef57 [schema] Collect and display names and e-mail addresses.
(imported from commit aa6bceb05fcd5b456c03288cbfed65b14050fe88)
2012-09-11 16:34:53 -04:00
Luke Faraone 4503aaae89 Implement gravatars.
(imported from commit 1e07d295ee7c12a95091e0785a9a9c3c4e856ede)
2012-09-10 18:18:09 -04:00
Tim Abbott 37b1c1db11 Stop using foo.pk when we mean foo.id.
(imported from commit b86359254415f65b32eeefdfbcb38d7bb862c1ac)
2012-09-10 13:43:17 -04:00
Tim Abbott ca132789bb [schema] Store Recipient types more efficiently.
(imported from commit e0625ce9d2382682a5c8d53a5ac31a0399075df8)
2012-09-10 10:03:50 -04:00
Tim Abbott b6203e7240 Comment on how filter_by_subscriptions is dead.
(imported from commit c13b2ed003d78408b7c4f51ef5080658c2b4bcc7)
2012-09-07 13:54:42 -04:00
Tim Abbott f39c203d2c Cleanup style of filter_by_subscriptions.
(imported from commit 4bc62dcc97eeb98147dd73163c75a142eaf5d3c9)
2012-09-07 13:53:24 -04:00
Tim Abbott 7f6d085ab6 Improve add_callback performance.
(imported from commit 4cea356ee6b0777bddfc996d7b8ee1b5fee391c6)
2012-09-07 13:51:54 -04:00
Tim Abbott d8ade6de5b Add create_zephyr_class helper.
(imported from commit 993fbb799b706e402ae212330e4abbe28bf84ee9)
2012-09-07 13:28:56 -04:00
Tim Abbott 6c330b2654 [schema] Store zephyr receipts in new UserMessage table.
(imported from commit d909adf7528aba9a489280ebc3572791539cdd44)
2012-09-07 11:27:41 -04:00
Tim Abbott ef25dffb92 [schema] Add the realm to the ZepyhrClass objects.
(imported from commit 8189ef27f2feef0c92f9c06a9243c085e36a66f5)
2012-09-06 11:02:34 -04:00
Tim Abbott b761bf030b [schema] Fix names of fields in Subscription.
(imported from commit 5f5c643286d348d16caac03419ba3011a8b81eff)
2012-09-06 11:02:34 -04:00
Tim Abbott 38b30e5997 [schema] Add realms to the schema.
Note that realms aren't actually used for anything, aren't prompted
for, etc, so this is mostly just a schema change and the refactoring
needed to allow setting the realm in the future.

(imported from commit b8b483dcc9601b288702284879e9c99707a50a5c)
2012-09-06 11:02:34 -04:00
Keegan McAllister 04b1c21333 Remove some unnecessary intermediate lists
Use generator comprehensions for efficiency and cleaner code.

(imported from commit 6b4b709515b5c904ef38b8ea33a9d4a4af0f5468)
2012-09-05 11:41:53 -04:00
Tim Abbott 3e51ef8c1c Fix get_huddle handling of id_list.
(imported from commit 0fe1ee15b2fc6b3bef98ac47f1094b89e776c751)
2012-09-05 11:38:09 -04:00
Tim Abbott 1f151214c0 Move the huddle recipient uniquification into get_huddle.
(imported from commit 09378b583becce6467d65d6caec71a543e27be2e)
2012-09-05 11:30:40 -04:00
Tim Abbott 7105ea9290 Improve the huddle hashing keys.
(imported from commit e8e1f1ac3022f3cecfdd22d1d4f319cc4f1ce886)
2012-09-05 11:19:31 -04:00
Luke Faraone be3a69611a Restrict new_zephyrs in add_callback to current user's subs.
(imported from commit 7aab1b081cf9b8602512402547fe3592cf710d82)
2012-09-05 10:43:36 -04:00
Tim Abbott 4d284d8a92 [schema] Add support for multi-user personals ("huddles").
This is controlled by listing multiple comma-separate usernames in the
personal message sending box.

(imported from commit 06c9dadb7977b98f88ad31e5df453b59f1afad96)
2012-09-04 19:15:07 -04:00
Tim Abbott 8f058937a0 Rename recipient.user_or_class to type.id.
(imported from commit 74639cd08d0f53ae39624fc793f6fe55325b6d45)
2012-09-04 16:34:39 -04:00
Jessica McKellar 15516b52dc Auto-sub to personals on account creation.
(imported from commit 5b8b5b0c670bdd4c9663837a15dd80bcbc6ddcb1)
2012-08-31 10:58:09 -04:00