Fix #2137: Avoid showing 'null' when intending to clear a value.

It turns out that jQuery treats a null input to the text() method
as a valid input, and converts it to a string. Replace this with an
empty string instead to clear the value as originally intended.

Change-Id: Ie616038fc05ec24c03f8e9fceb0396cae485f472
Add Jasmine based JavaScript tests for the template expander.

These expose, and provide testing for, the now-known bug where it
doesn't cope with empty values for adjacent template blocks.

Change-Id: I9523c4777efd1084164b92540707cebab33b29fa
Fix the template expander's handling of empty values.

In cases where the templated values are adjacent, and the values
being inserted were empty strings, some of the template blocks got
overlooked.

Change-Id: I96d9fb0db35523de37759294c2c439b8f0c45aad
Fix #2161: Allow teachers to create teachers.

This adds an extra setting to the edit user interface which allows
changing the selected user between `student` and `teacher` roles.

2013-12-01 Patch set 2: Extract template fix, tweak quoting in spec.
2013-12-01 Patch set 3: Ensure correct test behaviour by adding saves.

Change-Id: I7acea513aa71b1c49b72657f3ee9ce95c6dc5268
Allow for future expansion of registration rejection reasons.

Change-Id: Id5ce6e182fc24757573250935e6765dc04ec01c3
Fix #2183: Reject emails that can't work.

This modifies the registration page (only) to reject emails that don't
conform to the general pattern of a@b.cc. This does not ensure that
the email is valid, but prevents wildly invalid data being entered.
Validation is done both in JS and on the backend, and the input field
is updated to make use of HTML5 validation too.

Change-Id: I8263dc9b8ecfedc6b10939f6234585e1a4df831e
Fix missing jQuery wrapping.

This caused an issue in IE8.

Change-Id: I175ea2a7846d7a3cfe848c411398d64406399ab3
Use a real team-leader username.

This ensures that it can be used properly for sending emails to, etc.

Change-Id: Icde8fc548c743315d6892a5126171944ac1e6f44
Move test to own class to avoid redundant setup/teardown.

The setup/teardown aren't needed for the email validity checks, so
it may as well have its own class.

Change-Id: Ie3e52531d7bd1f84424257501c15a90b67148db9
Add a helper for logging actions.

This provides a simple way to easily log plenty of information without
needing to worry about the boilerplate formatting it.

Change-Id: I01e9158273e867c3c903877a9bce4a87b6cbb69d
Make the string representations of KeyedSqliteThings nicer.

It now returns a string of their class name, id and properties.
This should make debugging simpler, as well as making it possible
to just throw these at logging calls and have nice data in the log.

Change-Id: Ie0a2d1b48e9e1c5daa516b568eb87c76179fb77b
Actually make the log_action helper cope with objects.

Previously, it assumed that the *args values were all strings, and
didn't bother converting them.

Change-Id: Ic0982d1bb92968cfedb621d3b43dd0d3af4b8997
Fix #2180: Add logging at various useful places.

This adds logging at level INFO for most of the major actions that
nemesis can perform, specifically: registration, activation, email
changes, email change expiry and registration expiry. This also
adds logging inside the mailer component against the same logger
(if needed we can make it use a separate logger at some point),
which also logs various things at INFO, as well as now actually
reporting any exceptions when sending emails.

Change-Id: I43e0b48a4e0b368f0ea17c967c03a4aec7f0a77e
Extract local variables for clarity.

Change-Id: Ida9db2342120ab16925636850402b7b4c1f8ae3b
Configure logging via a logging.ini file.

The name of this file is configurable via the existing config support,
enabling it to be changed easily for alternative development scenarios
or for production. This moves the current config to use that file,
and ensures that all the python scripts also configure it as needed.

Change-Id: I12699fb152f6677e05bd1370a68d75f607a87f08
Provide a syslog logging configuration too.

This emits information at local0, which users need to configure in
syslog, but otherwise contains suitable defaults for general usage
on linux systems (ie using /dev/log).

Change-Id: I72226ab19956e4441abe9a46dc3e3d1d45fa3982
Fix #2182: Provide more info to team-leaders during account creation.

This modifies the template sent out during the registration step so that
it's clearer that the account hasn't actually been activated yet, and lets
the team-leaader know to expect another email when that does happen. Also
add that email plus tests that it gets sent.

Change-Id: I340b11e81f8a816b5ff38979df703791efd0f68a
2163: Fix HTTP 500 on blank user name

Makes it use a proper form submit so we can have required input fields.