Commit Graph

75 Commits

Author SHA1 Message Date
e4453cdda9 Add support for sending out news as HTML email
When a news article is approved, it gets delivered as an email to the
pgsql-announce mailinglist. It will render the markdown of the news
article into a HTML part of the email, and include the markdown raw as
the text part (for those unable or unwilling to read html mail).

For each organisation, a mail template can be specified. Initially only
two templates are supported, one "default" and one "pgproject" which is
for official project news. The intention is *not* to provide generic
templates, but we may want to extend this to certain related projects in
the future *maybe* (such as regional NPOs).

These templates are stored in templates/news/mail/*.html, and for each
template *all* images found in templates/news/mail/img.<template>/ will
be attached to the email. "Conditional image inclusion" currently not
supported.

To do CSS inlining on top of the markdown output, module pynliner is now
required (available in the python3-pynliner package on Debian).

A testing script is added as news_send_email.py in order to easier test
out templates. This is *not* intended for production sending, so it will
for example send unmoderated news. By sending, it adds it to the
outgoing mailqueue in the system, so unless the cronjob is set up to
send, nothing will happen until that is run manually.

Support is included for tagged delivery using pglister, by directly
mapping NewsTags to pglister tags.

While at it, update the moderation preview forms to preview news items
using the HTML template for the email (while leaving other types of
items previewing without a particular stylesheet).
2020-09-10 14:52:41 +02:00
90eec2b3af Store project root directory in settings
This makes it possible to reference for example templates in relation to
the root directory.
2020-09-10 14:52:41 +02:00
b2ffced2b0 Update more links to be https instead of http 2020-08-31 11:56:47 +02:00
f5d99ed262 Add support for easily enabling the django debug toolbar
This requires the web server to also configure a static mapping for
/media/django_toolbar/ pointing into the django toolbar directories.
2020-08-08 17:09:59 +02:00
7ee12fdcd8 Set a default DATE_FORMAT
We already set DATETIME_FORMAT, but it makes sense to also set
DATE_FORMAT. In all our frontend templates we were already using an
explicit format, but this will help the /admin/ side.
2020-07-03 18:05:54 +02:00
7f8a0a56dd Load signal handlers from an app instead of urllist
This is the place to load them to make sure they always load. This means
we can also now remove a hardcoded special varnish purging in the CVE
crawler script, because all saves including those from cron jobs will
now fire the signals and thus the automatic varnish purges.
2020-07-03 17:57:25 +02:00
e02761dfcf Middleware and urls update for django 2.2 2020-03-31 22:55:13 +02:00
5d7cf9833f Remove dependency on django-selectable 2020-03-31 22:55:13 +02:00
7547b6f766 Update syntax for relative imports 2019-01-26 16:19:26 +01:00
0883ac6423 Fix whitespace and indentation, per pep8 2019-01-17 20:47:43 +01:00
87237f6536 Tabs, meet your new overlords: spaces
In a quest to reach pep8, use spaces to indent rather than tabs.
2019-01-17 15:35:39 +01:00
747cc8f06a Add support for doing ESI on pages in Varnish 2018-06-29 18:03:25 +02:00
dcd98cf6fe Add support for automatic template based xkey
This adds an xkey header to all outgoing requests with the hash of the
name of all templates loaded. In the future we will be able to use this
to purge "all pages that included a specific template", regardless of
where in the hierarchy it was loaded.

Do this by faking a template loader that never finds anything -- but it
will record the path of the template that it tried to load, and then
leave it to another template loader to actually load it. Store this in
thread local storage (it's a bit ugly, but it's the only thing Django
supports for storing things at the request level from a template
loader), and fetch it from the middleware.
2018-06-29 18:01:35 +02:00
73706bdaba Rename NOREPLY_FROM to ACCOUNTS_NOREPLY_FROM
This is today only used for things coming out of the accounts system,
like new accounts and password resets. To make sure we don't
accidentally start using it for something else, change the name of the
parameter.
2018-05-01 17:52:15 +02:00
c28e2d0e2a Remove setting no longer used 2018-04-04 18:25:02 +02:00
c11e39415b Fix template loaders for django 1.11
Seems django 1.11 automatically enables caching template loader, which
of course breaks the ability to make any changes to the pages of a
website without restarting it. And there is no way to turn it off other
than to explicitly configure individual loders (the logic to turn it on
in non-debug configurations is hardcoded and cannot be changed).
2018-03-25 16:51:48 +02:00
dff46c8f7c Remove incorrect commented out line
Can't use that line without the comment, so get rid of the comment.
2018-03-21 14:17:51 +01:00
10b8ee7de4 Fix context processor class name for newer django
Missed this in 09f904f787
2018-03-10 10:57:55 -05:00
09f904f787 Update template configuration for newer django
Also fully backwards compatible
2018-03-09 15:58:49 -05:00
d37b7396ff Support contacting archives search server over http
This makes it a lot easier to do local testing. Of course, in production
we use https and by default.
2018-03-05 13:11:28 +01:00
0cb56d9355 Database:ify the list of security patches
This finally moves the patches into the db, which makes it a lot easier
to filter patches in the views.

It also adds the new way of categorising patches, which is assigning
them a CVSSv3 score.

For now, there are no public views to this, and the old static pages
remain. This is so we can backfill all existing security patches before
we make it public.
2018-01-25 21:59:13 +01:00
d0aa8ac119 Remove majordomo2 subscription form
Replace it with a redirect to lists.postgresql.org, where pglister lives.
2018-01-23 21:20:19 +01:00
dfd46afae4 Send -bugs and -docs emails from noreply address
Sending from the submitters address runs afoul to DMARC and other
restrictions. Instead, send the email from a defined noreply address.
Instead, add the original submitter to both the Cc and the Reply-To
header, to make sure they receive followups.

Patch by Stephen, minor changes by Magnus
2017-12-18 15:59:18 +01:00
07345c1458 Remove legacy workaround to support old community auth
This workaround enabled a weaker password hasher to work with old
versions of the community authentication plugin. This was already
overridden in prod, but remove the old workaround completely from the
code so we don't accidentally re-enable it.
2017-12-10 16:40:02 +01:00
2f52c4f7c4 Clean up whitespace in primary Python / HTML files
Clean up the whitespace in the primary Python / HTML files in
order to make it easier to apply changes going forward.
2017-11-29 08:21:35 -05:00
cc8c058857 Split out noreply sender address to separate config parameter
We want to use the noreply@ email address when sending out notifications
to addresses that have yet to be verified, since we can just ignore
bounces to those.
2017-09-27 12:01:45 +02:00
9a77d1747a Implement support for Oauth2 based login integrations
This creates Google, Github, Microsoft and Facebook login integrations.
Other providers can also be added if needed. Accounts still need to be
created in the community auth system, and will be automatically created
on first login, when the user also gets to pick a username. Once an
account exists, it will be matched on email address from the external
systems.

No methods are enabled by default, as they all require encryption keys
and identities configured in local_settings.py.

Review by Stephen Frost, Jonathan Katz and Daniel Gustafsson.
2017-08-28 16:31:57 +02:00
20a0e178c5 Add simple API endpoint to activate and deactivate a list
Access is restricted by IP for the list server. Once the migration is
done, we should probably remove the endpoint again.
2017-07-03 15:35:55 +01:00
0354a5ec0f Remove support for repo updated trigger
This was never actually completed, and we have other ways to deal with
the deployments now that are faster.
2017-06-27 15:14:20 +02:00
d09fde9ba3 Add function to spider reporpms from the yum repo
The ftp server can then submit a list (and structure) of which platforms
are supported for yum downloads, which can then later (in a separate
commit) be used to generate a nicer download for yum repo rpms.
2017-05-24 13:48:04 -04:00
27e1c73368 Implement auto-complete for /admin/ forms that reference User
We have so many users now that loading these forms take forever.
Instead, implement a textbox with autocomplete using django-selectable,
which will not load the whole list of users at once.
2016-06-23 17:59:45 +02:00
319412156e Secure csrf tokens
Since we have no forms over non-http now, make sure the cookies are
locked
2016-05-24 21:14:33 +02:00
3c089cd09a Remove SSL decorators and middleware
The site is now served regardless of SSL, and assumes that the webserver
or web cache ensures that things rae always SSL.
2016-05-24 21:13:00 +02:00
b1ae5f8ec0 Remove workaround for django bug #15152.
This bug is fixed before django 1.8, so remove our workaround which
should now be unnecessary.
2016-05-19 14:23:52 -04:00
2952b39754 Replace interactive docs with docs bug reporting
Per discussion from a long time ago, interactive docs aren't really
working out. The majority of submissions are either support questions
(which then get rejected because they cannot be answered in this
context) or pointing out docs incorrectnesses (which should be submitted
as a docs bug instead, so they can actually be fixed in the main
documentation).

Old references to /interactive/ will get redirected to /static/
automatically, and we expect to keep doing that for a long time (since
there are many links to them around the net).
2016-05-19 10:42:44 -04:00
118b1193b8 Remove pwn module and links
The pwn module has never been used, as the pwn are simply sent to
-announce and nothing else. We've kept the code and model around for
doing it on the site for years now and it's unused, so let's remove it
to cut down on maintenance cost.
2016-05-14 22:17:07 +02:00
6eafeb769a Django no longer ships with buildin markdown
Instead, use django_markwhat, the same as we've done for other
postgreslq.org django projects.
2016-05-14 19:49:12 +02:00
350b936e58 Prefix cross-application imports with pgweb
As required by the new project layout.
2016-05-14 19:49:12 +02:00
498e786c0e Move files and directories for new project layout
Move manage.py up one step, set up a new wsgi.py file, and adjust
relative paths that refer to other directories for the new project
layout that we need to use in django 1.8.
2016-05-14 19:49:12 +02:00
2f8bbc40dd Replace pgq with trivial local queue implementation
The queue used for varnish purges has so few entries that it's really
not worth paying the management overhead for skytools/pgq. Instead we
can use a very simple local deamon using LISTEN/NOTIFY to fire them off.

Now include a proper nagios plugin in this package, so we can get rid
of the not-very-nice munin plugin currently used in the deployment.
2016-05-14 19:49:12 +02:00
aa5a257c71 Implement basic re-captcha handling
I very much hate captchas, but we need something, and using something like
re-captcha for it makes it easy to implement.
2015-12-17 13:37:49 +01:00
596520ba13 Implement workaround for django bug #15152 for badly encoded URLs
Hopefully this will stop the system spamming us..
2014-06-03 09:26:48 +02:00
b39a87fa5f Add API url that drops a trigger file for updates
The idea is a git repository hook will send a POST to this URL, which
will drop a trigger file somewhere. A cronjob (or inotify listener if
we want to be really fancy sometiem in the future) will pick up that
cronjob and run the update script. The goal being to shorten the time
required to process an update.
2014-04-13 14:11:19 +02:00
bfa9b2a105 Track which emails are "user generated" for different antispam treatment
Basically, user generated email (bug report form) will be sent to the mail
frontends for antispam. Any errors generated there will be ignored and
the mails "dropped on the floor". Other emails keep entering the system
through localhost and delivered there.
2014-01-11 20:46:48 +01:00
8f0b7e6b50 Switch email sending go through a queue table in the database
Import the code from the PostgreSQL Europe website to handle this, since it's
well proven by now.

Any points that send email now just write them to the database using the
functions in queuedmail.util. This means we can now submit notification
emails and such things within transactions and have them properly roll bcak
if something goes wrong (so no more incorrect notifications when there is
a database error).

These emails are picked up by a cronjob that runs frequently (typically
once per minute or once every 2 minutes) that submits them to the local
mailserver. By doing it out of line, this gives us a much better way of
dealing with cases where mail delivery is really slow.

The submission from the cronjob is now done with smtp to localhost instead
of opening a pipe to the sendmail command - though this should have no
major effects on anything.

This also removes the setting SUPPRESS_NOTIFICATIONS, as no notifications
are actually ever sent unless the cronjob is run. On development systems
they will just go into the queuedmail table, and can be deleted from there.
2014-01-11 12:33:06 +01:00
48410d04fa Enable cache-busting URLs for CSS and JS
This will allow us to increase the cache times in the browser for our
CSS, which almost never changes.

Enables a new value to be used in templates, {{gitrev}}, which can be
used to bust pretty much any URL. We could do this for all the images
in the templates as well, but since most of them almost never change,
we'll just enable it manually for each individual image as it becomes
necessray - or just use a ?1, ?2 etc for those.

Enabled by default for CSS and JavaScript links, since those are much
more likely to be changed without having the URL changed.

Cache times aren't increased yet - we'll do that later one we're sure
that all existing caches are expired first.
2014-01-01 15:24:51 +01:00
d1535febb9 Make the varnish queue id configurable
This is required if the queue is dropped and recreated in pgq as it
gets a new id, which needs to be used when viewing the current status
of the queue in the admin interface.
2013-09-10 13:54:54 +02:00
fdd1404f37 Get the list of documentation versions out of the database
Instead of having to update this list manually in multiple places when
releasing new versions, just take the information out of the database
where it has to be anyway.

Fixes #90
Closes #93

Also make the code automatically pick up wich PDF files exist in the
static checkout, and auto-detect their size, both A4 and US sizes. This
removes yet one more manual step, yay!

Fixes #163
2013-08-17 17:28:36 +02:00
3ea91f449c Revert to SHA1 hashing for stored passwords
This is required for the old style community auth system that is still
in use by the commitfest app. Once that has been retired or upgraded,
this patch should be reverted.

Existing passwords are automatically converted once the user logs in to
the main website once.
2013-06-20 11:40:13 +02:00
1a04a9c2bd Update contexts and processors for django 1.4
Some requirements from the admin interface are also mandatory now,
so include those.
2013-06-16 16:35:21 +02:00