diff options
45 files changed, 260 insertions, 215 deletions
diff --git a/TODO.txt b/TODO.txt deleted file mode 100644 index ee3007b6d..000000000 --- a/TODO.txt +++ /dev/null @@ -1,27 +0,0 @@ - -Auth: - * add 'remember me' option on login. - * limit session to this browser session on create account - * redirect back to page they came from on login - -Problem creation: - ? what should the new flow be for not-logged-in (probably unchanged). - * after becoming confirmed require user to manually send off 'pending' reports - -Users: - * create a message to the user if they have reports which have not been - confirmed. - -Email: - * currently don't send email via EvEl or do any of the smarts it does - should - we switch to using it (Email::Send::EvEl...)? - -Framework: - * use Plack to handle all the redirects and also run cgi scripts - get apache - out of the picture (what about tile proxy...). Does this makes sense? - - - -Future ideas: - * dashboard for council to put on big screen - diff --git a/db/rerun_dbic_loader.pl b/db/rerun_dbic_loader.pl index 1261f2378..152d319b1 100755 --- a/db/rerun_dbic_loader.pl +++ b/db/rerun_dbic_loader.pl @@ -30,7 +30,7 @@ make_schema_at( overwrite_modifications => 1, # don't worry that the md5 is wrong # add in some extra components - components => [ 'FilterColumn', 'InflateColumn::DateTime' ], + components => [ 'FilterColumn', 'InflateColumn::DateTime', 'EncodedColumn' ], }, FixMyStreet->dbic_connect_info(), diff --git a/perl-external/files.txt b/perl-external/files.txt index fb5786aa8..f594e80af 100644 --- a/perl-external/files.txt +++ b/perl-external/files.txt @@ -161,6 +161,7 @@ /authors/id/M/MA/MAKAMAKA/JSON-PP-2.27105.tar.gz /authors/id/M/MA/MANU/Net-IP-1.25.tar.gz /authors/id/M/MA/MARKOV/MIME-Types-1.31.tar.gz +/authors/id/M/MA/MAUKE/Dir-Self-0.10.tar.gz /authors/id/M/MH/MHX/Devel-PPPort-3.19.tar.gz /authors/id/M/MI/MIROD/HTML-TreeBuilder-XPath-0.12.tar.gz /authors/id/M/MI/MIROD/XML-XPathEngine-0.12.tar.gz @@ -250,5 +251,9 @@ /authors/id/T/TU/TURNSTEP/DBD-Pg-2.18.1.tar.gz /authors/id/U/UL/ULPFR/Text-German-0.06.tar.gz /authors/id/V/VP/VPIT/Variable-Magic-0.46.tar.gz +/authors/id/W/WR/WREIS/DBIx-Class-EncodedColumn-0.00011.tar.gz /authors/id/X/XE/XERN/Lingua-PT-Stemmer-0.01.tar.gz /authors/id/Y/YV/YVES/ExtUtils-Install-1.54.tar.gz +/authors/id/Z/ZE/ZEFRAM/Class-Mix-0.004.tar.gz +/authors/id/Z/ZE/ZEFRAM/Crypt-Eksblowfish-0.009.tar.gz +/authors/id/Z/ZE/ZEFRAM/Params-Classify-0.013.tar.gz diff --git a/perl-external/minicpan/modules/02packages.details.txt.gz b/perl-external/minicpan/modules/02packages.details.txt.gz Binary files differindex dfe6e38ba..d78040bab 100644 --- a/perl-external/minicpan/modules/02packages.details.txt.gz +++ b/perl-external/minicpan/modules/02packages.details.txt.gz diff --git a/perl-external/modules.txt b/perl-external/modules.txt index 7b640c215..4568fc706 100644 --- a/perl-external/modules.txt +++ b/perl-external/modules.txt @@ -18,7 +18,9 @@ Catalyst::View::TT Class::Accessor Class::Unload Config::General +Crypt::Eksblowfish::Bcrypt DBIx::Class +DBIx::Class::EncodedColumn DBIx::Class::FilterColumn DBIx::Class::Schema::Loader DBIx::Class::Storage::DBI diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm index b5838a169..47b290eff 100644 --- a/perllib/FixMyStreet/App.pm +++ b/perllib/FixMyStreet/App.pm @@ -61,8 +61,7 @@ __PACKAGE__->config( credential => { # Catalyst::Authentication::Credential::Password class => 'Password', password_field => 'password', - password_type => 'hashed', - password_hash_type => 'SHA-1', + password_type => 'self_check', }, store => { # Catalyst::Authentication::Store::DBIx::Class class => 'DBIx::Class', diff --git a/perllib/FixMyStreet/App/Controller/Auth.pm b/perllib/FixMyStreet/App/Controller/Auth.pm index 9ff415bf4..8aed746ec 100644 --- a/perllib/FixMyStreet/App/Controller/Auth.pm +++ b/perllib/FixMyStreet/App/Controller/Auth.pm @@ -7,7 +7,6 @@ BEGIN { extends 'Catalyst::Controller'; } use Email::Valid; use Net::Domain::TLD; use mySociety::AuthToken; -use Digest::SHA1 qw(sha1_hex); =head1 NAME @@ -15,14 +14,14 @@ FixMyStreet::App::Controller::Auth - Catalyst Controller =head1 DESCRIPTION -Controller for all the authentication related pages - create account, login, -logout. +Controller for all the authentication related pages - create account, sign in, +sign out. =head1 METHODS =head2 index -Present the user with a login / create account page. +Present the user with a sign in / create account page. =cut @@ -37,25 +36,27 @@ sub general : Path : Args(0) { return unless $req->method eq 'POST'; # decide which action to take - $c->detach('email_login') if $req->param('email_login'); - $c->detach('login'); # default + $c->detach('email_sign_in') if $req->param('email_sign_in'); + + $c->forward( 'sign_in' ) + && $c->detach( 'redirect_on_signin', [ $req->param('r') ] ); } -=head2 login +=head2 sign_in -Allow the user to legin with a username and a password. +Allow the user to sign in with a username and a password. =cut -sub login : Private { - my ( $self, $c ) = @_; +sub sign_in : Private { + my ( $self, $c, $email ) = @_; - my $email = $c->req->param('email') || ''; - my $password = $c->req->param('password') || ''; - my $remember_me = $c->req->param('remember_me') || 0; + $email ||= $c->req->param('email') || ''; + my $password = $c->req->param('password_sign_in') || ''; + my $remember_me = $c->req->param('remember_me') || 0; - # logout just in case + # Sign out just in case $c->logout(); if ( $email @@ -67,22 +68,22 @@ sub login : Private { $c->set_session_cookie_expire(0) unless $remember_me; - $c->detach( 'redirect_on_signin', [ $c->req->param('r') ] ); + return 1; } - # could not authenticate - show an error - $c->stash->{login_error} = 1; + $c->stash->{sign_in_error} = 1; + return; } -=head2 email_login +=head2 email_sign_in -Email the user the details they need to log in. Don't check for an account - if +Email the user the details they need to sign in. Don't check for an account - if there isn't one we can create it when they come back with a token (which contains the email addresss). =cut -sub email_login : Private { +sub email_sign_in : Private { my ( $self, $c ) = @_; # check that the email is valid - otherwise flag an error @@ -105,10 +106,12 @@ sub email_login : Private { my $token_obj = $c->model('DB::Token') # ->create( { - scope => 'email_login', + scope => 'email_sign_in', data => { email => $good_email, r => $c->req->param('r'), + name => $c->req->param('name'), + password => $c->req->param('password_register'), } } ); @@ -120,7 +123,7 @@ sub email_login : Private { =head2 token -Handle the 'email_login' tokens. Find the account for the email address +Handle the 'email_sign_in' tokens. Find the account for the email address (creating if needed), authenticate the user and delete the token. =cut @@ -131,7 +134,7 @@ sub token : Path('/M') : Args(1) { # retrieve the token or return my $token_obj = $url_token ? $c->model('DB::Token')->find( { - scope => 'email_login', token => $url_token + scope => 'email_sign_in', token => $url_token } ) : undef; @@ -140,20 +143,23 @@ sub token : Path('/M') : Args(1) { return; } - # logout in case we are another user + # Sign out in case we are another user $c->logout(); # get the email and scrap the token - my $email = $token_obj->data->{email}; - my $redirect = $token_obj->data->{r}; + my $data = $token_obj->data; $token_obj->delete; - # find or create the user related to the token and delete the token - my $user = $c->model('DB::User')->find_or_create( { email => $email } ); + # find or create the user related to the token. + my $user = $c->model('DB::User')->find_or_create( { email => $data->{email} } ); + $user->name( $data->{name} ) if $data->{name}; + $user->password( $data->{password} ) if $data->{password}; + $user->update; + $c->authenticate( { email => $user->email }, 'no_password' ); # send the user to their page - $c->detach( 'redirect_on_signin', [ $redirect ] ); + $c->detach( 'redirect_on_signin', [ $data->{r} ] ); } =head2 redirect_on_signin @@ -171,7 +177,7 @@ sub redirect_on_signin : Private { =head2 redirect -Used when trying to view a page that requires login when you're not. +Used when trying to view a page that requires sign in when you're not. =cut @@ -219,18 +225,18 @@ sub change_password : Local { } # we should have a usable password - save it to the user - $c->user->obj->update( { password => sha1_hex($new) } ); + $c->user->obj->update( { password => $new } ); $c->stash->{password_changed} = 1; } -=head2 logout +=head2 sign_out Log the user out. Tell them we've done so. =cut -sub logout : Local { +sub sign_out : Local { my ( $self, $c ) = @_; $c->logout(); } diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 130eee858..a6be6c90c 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -28,8 +28,6 @@ Create a new report, or complete a partial one . =head2 flow control -submit_map: true if we reached this page by clicking on the map - submit_problem: true if a problem has been submitted =head2 location (required) @@ -564,7 +562,7 @@ sub process_user : Private { unless $report->user; # set the user's name and phone (if given) - $report->user->name( Utils::trim_text( $params{name} ) ); + $report->user->name( Utils::trim_text( $params{name} ) ) if $params{name}; $report->user->phone( Utils::trim_text( $params{phone} ) ); return 1; @@ -912,9 +910,12 @@ sub redirect_or_confirm_creation : Private { } # otherwise create a confirm token and email it to them. - my $token = - $c->model("DB::Token") - ->create( { scope => 'problem', data => $report->id } ); + my $token = $c->model("DB::Token")->create( { + scope => 'problem', + data => { + id => $report->id + } + } ); $c->stash->{token_url} = $c->uri_for_email( '/P', $token->token ); $c->send_email( 'problem-confirm.txt', { to => [ [ $report->user->email, $report->name ] ], diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm index 5421385fb..2d810d871 100644 --- a/perllib/FixMyStreet/App/Controller/Report/Update.pm +++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm @@ -21,8 +21,8 @@ sub report_update : Path : Args(0) { my ( $self, $c ) = @_; $c->forward( '/report/load_problem_or_display_error', [ $c->req->param('id') ] ) - && $c->forward('process_user') && $c->forward('process_update') + && $c->forward('process_user') && $c->forward('/report/new/process_photo') && $c->forward('check_for_errors') or $c->go( '/report/display', [ $c->req->param('id') ] ); @@ -90,28 +90,24 @@ Load user from the database or prepare a new one. sub process_user : Private { my ( $self, $c ) = @_; - my $update_user; - if ( $c->user ) { - - $update_user = $c->user->obj; - - } else { + my $update = $c->stash->{update}; - # Extract all the params to a hash to make them easier to work with - my %params = # - map { $_ => scalar $c->req->param($_) } # - ( 'rznvy', 'name' ); + $update->user( $c->user->obj ) if $c->user; - # cleanup the email address - my $email = $params{rznvy} ? lc $params{rznvy} : ''; - $email =~ s{\s+}{}g; + # Extract all the params to a hash to make them easier to work with + my %params = # + map { $_ => scalar $c->req->param($_) } # + ( 'rznvy', 'name' ); - $update_user = $c->model('DB::User')->find_or_new( { email => $email } ); - $update_user->name( Utils::trim_text( $params{name} ) ); + # cleanup the email address + my $email = $params{rznvy} ? lc $params{rznvy} : ''; + $email =~ s{\s+}{}g; - } + $update->user( $c->model('DB::User')->find_or_new( { email => $email } ) ) + unless $update->user; - $c->stash->{update_user} = $update_user; + $update->user->name( Utils::trim_text( $params{name} ) ) + if $params{name}; return 1; } @@ -146,7 +142,6 @@ sub process_update : Private { text => $params{update}, name => $name, problem => $c->stash->{problem}, - user => $c->stash->{update_user}, state => 'unconfirmed', mark_fixed => $params{fixed} ? 1 : 0, cobrand => $c->cobrand->moniker, diff --git a/perllib/FixMyStreet/App/Controller/Tokens.pm b/perllib/FixMyStreet/App/Controller/Tokens.pm index 111508e60..c9c9f3ab7 100644 --- a/perllib/FixMyStreet/App/Controller/Tokens.pm +++ b/perllib/FixMyStreet/App/Controller/Tokens.pm @@ -32,7 +32,7 @@ sub confirm_problem : Path('/P') { $c->forward( 'load_auth_token', [ $token_code, 'problem' ] ); # Load the problem - my $problem_id = $auth_token->data; + my $problem_id = $auth_token->data->{id}; my $problem = $c->cobrand->problems->find( { id => $problem_id } ) || $c->detach('token_error'); $c->stash->{problem} = $problem; diff --git a/perllib/FixMyStreet/DB/Result/Abuse.pm b/perllib/FixMyStreet/DB/Result/Abuse.pm index df3ebe24a..b1cf9c1ed 100644 --- a/perllib/FixMyStreet/DB/Result/Abuse.pm +++ b/perllib/FixMyStreet/DB/Result/Abuse.pm @@ -8,14 +8,14 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("abuse"); __PACKAGE__->add_columns("email", { data_type => "text", is_nullable => 0 }); __PACKAGE__->set_primary_key("email"); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-05-24 15:32:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Bc0deuJiQlKyMGzLTUAIxg +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:IuTLiJSDZGLF/WX8q3iKIQ # You can replace this text with custom code or comments, and it will be preserved on regeneration 1; diff --git a/perllib/FixMyStreet/DB/Result/AdminLog.pm b/perllib/FixMyStreet/DB/Result/AdminLog.pm index e57773e63..da97950a0 100644 --- a/perllib/FixMyStreet/DB/Result/AdminLog.pm +++ b/perllib/FixMyStreet/DB/Result/AdminLog.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("admin_log"); __PACKAGE__->add_columns( "id", @@ -36,8 +36,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("id"); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-06 18:52:09 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VKN3o9SHoDhG2/H5NInf2w +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7427CuN3/6IL2GxiQDoWUA # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/Alert.pm b/perllib/FixMyStreet/DB/Result/Alert.pm index 3a2dc9a9f..eddd98f37 100644 --- a/perllib/FixMyStreet/DB/Result/Alert.pm +++ b/perllib/FixMyStreet/DB/Result/Alert.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("alert"); __PACKAGE__->add_columns( "id", @@ -64,8 +64,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-03 16:48:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:NlyhWyg0NrH5/kZYYO36qg +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:d2TrE9UIZdXu3eXYJH0Zmw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/AlertSent.pm b/perllib/FixMyStreet/DB/Result/AlertSent.pm index 85a9000d5..a901c2fde 100644 --- a/perllib/FixMyStreet/DB/Result/AlertSent.pm +++ b/perllib/FixMyStreet/DB/Result/AlertSent.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("alert_sent"); __PACKAGE__->add_columns( "alert_id", @@ -30,8 +30,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-03 16:48:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:x1nMIiNFSTKxdPxZmko18Q +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fTiWIoriQUvHpWc9PpFLvA # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/AlertType.pm b/perllib/FixMyStreet/DB/Result/AlertType.pm index 7a3cd1e36..d23a2983d 100644 --- a/perllib/FixMyStreet/DB/Result/AlertType.pm +++ b/perllib/FixMyStreet/DB/Result/AlertType.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("alert_type"); __PACKAGE__->add_columns( "ref", @@ -47,8 +47,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-03 16:48:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KNZ7eWU/VgF8xzsjCHKVjw +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+PKqo7IZ4MlM9ur4V2P9tA # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm index 76c96e581..9ed9d8b48 100644 --- a/perllib/FixMyStreet/DB/Result/Comment.pm +++ b/perllib/FixMyStreet/DB/Result/Comment.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("comment"); __PACKAGE__->add_columns( "id", diff --git a/perllib/FixMyStreet/DB/Result/Contact.pm b/perllib/FixMyStreet/DB/Result/Contact.pm index 2b18e0250..001fb4ac6 100644 --- a/perllib/FixMyStreet/DB/Result/Contact.pm +++ b/perllib/FixMyStreet/DB/Result/Contact.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("contacts"); __PACKAGE__->add_columns( "id", @@ -39,7 +39,7 @@ __PACKAGE__->set_primary_key("id"); __PACKAGE__->add_unique_constraint("contacts_area_id_category_idx", ["area_id", "category"]); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-05-24 15:32:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8u8S4QtIf0n7QUxVuP/Siw +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BXGd4uk1ybC5RTKlInTr0w 1; diff --git a/perllib/FixMyStreet/DB/Result/ContactsHistory.pm b/perllib/FixMyStreet/DB/Result/ContactsHistory.pm index 4fa74a9a2..811a06b44 100644 --- a/perllib/FixMyStreet/DB/Result/ContactsHistory.pm +++ b/perllib/FixMyStreet/DB/Result/ContactsHistory.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("contacts_history"); __PACKAGE__->add_columns( "contacts_history_id", @@ -40,8 +40,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("contacts_history_id"); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-02 18:27:49 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:D9Uu5Lp8BackyZdLXJDIvw +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9APvBwAOebG5g4MGxJuVKQ # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index fa3772310..1c8487ae7 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("problem"); __PACKAGE__->add_columns( "id", @@ -100,8 +100,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-05-24 15:32:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:U3aYCRwE4etekKaHdhEkIw +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3sw/1dqxlTvcWEI/eJTm4w # Add fake relationship to stored procedure table __PACKAGE__->has_many( diff --git a/perllib/FixMyStreet/DB/Result/Questionnaire.pm b/perllib/FixMyStreet/DB/Result/Questionnaire.pm index 5a507645f..cc4ec300b 100644 --- a/perllib/FixMyStreet/DB/Result/Questionnaire.pm +++ b/perllib/FixMyStreet/DB/Result/Questionnaire.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("questionnaire"); __PACKAGE__->add_columns( "id", @@ -40,8 +40,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-05-24 15:32:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BAWTYKAQ84VeOI6D2gtQOQ +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QNFqqCg6J4SFlg4zwm7TWw use DateTime::TimeZone; diff --git a/perllib/FixMyStreet/DB/Result/Secret.pm b/perllib/FixMyStreet/DB/Result/Secret.pm index 399f0be18..8a1fa671d 100644 --- a/perllib/FixMyStreet/DB/Result/Secret.pm +++ b/perllib/FixMyStreet/DB/Result/Secret.pm @@ -8,13 +8,13 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("secret"); __PACKAGE__->add_columns("secret", { data_type => "text", is_nullable => 0 }); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-03 12:02:18 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Htl6+DHfHy9l+bjBxAbH6Q +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MfqW1K0aFtwpa/1c/UwHjg # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/Session.pm b/perllib/FixMyStreet/DB/Result/Session.pm index a10e6fa0d..9d5d509dc 100644 --- a/perllib/FixMyStreet/DB/Result/Session.pm +++ b/perllib/FixMyStreet/DB/Result/Session.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("sessions"); __PACKAGE__->add_columns( "id", @@ -21,8 +21,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("id"); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-05-24 15:32:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tYWQtbja2nkA/2A+kaPl1g +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TagSQOXnDttkwfJ7oDH8Yw # You can replace this text with custom code or comments, and it will be preserved on regeneration 1; diff --git a/perllib/FixMyStreet/DB/Result/Token.pm b/perllib/FixMyStreet/DB/Result/Token.pm index d838e9fc2..3a900858d 100644 --- a/perllib/FixMyStreet/DB/Result/Token.pm +++ b/perllib/FixMyStreet/DB/Result/Token.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("token"); __PACKAGE__->add_columns( "scope", @@ -27,8 +27,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("scope", "token"); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-05-24 15:32:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ET4L1y6yWmEUDKPKa7wJiw +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:frl+na3HrIzGw9D1t891nA # Trying not to use this # use mySociety::DBHandle qw(dbh); diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm index dfcb18c5b..c0b078775 100644 --- a/perllib/FixMyStreet/DB/Result/User.pm +++ b/perllib/FixMyStreet/DB/Result/User.pm @@ -8,7 +8,7 @@ use warnings; use base 'DBIx::Class::Core'; -__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("users"); __PACKAGE__->add_columns( "id", @@ -54,6 +54,16 @@ __PACKAGE__->has_many( # Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-22 16:10:43 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zQIniwAXjl5Lh9wyiGuwFw +__PACKAGE__->add_columns( + "password" => { + encode_column => 1, + encode_class => 'Crypt::Eksblowfish::Bcrypt', + encode_args => { cost => 8 }, + encode_check_method => 'check_password', + }, +); +>>>>>>> 62ffebc89cc66d32a828ea1de8c850c3e950faa1 + use mySociety::EmailUtil; =head2 check_for_errors diff --git a/perllib/FixMyStreet/Map/FMS.pm b/perllib/FixMyStreet/Map/FMS.pm index d0a28be9b..a5a2dd9f0 100644 --- a/perllib/FixMyStreet/Map/FMS.pm +++ b/perllib/FixMyStreet/Map/FMS.pm @@ -11,9 +11,6 @@ use base 'FixMyStreet::Map::OSM'; use strict; -use constant ZOOM_LEVELS => 5; -use constant MIN_ZOOM_LEVEL => 13; - # Is set by the JavaScript sub map_type { return '""'; diff --git a/perllib/FixMyStreet/Map/OSM.pm b/perllib/FixMyStreet/Map/OSM.pm index 4543ce2da..9b968b4f6 100644 --- a/perllib/FixMyStreet/Map/OSM.pm +++ b/perllib/FixMyStreet/Map/OSM.pm @@ -51,10 +51,17 @@ sub copyright { sub display_map { my ($self, $c, %params) = @_; + my $numZoomLevels = ZOOM_LEVELS; + my $zoomOffset = MIN_ZOOM_LEVEL; + if ($params{any_zoom}) { + $numZoomLevels = 18; + $zoomOffset = 0; + } + # Adjust zoom level dependent upon population density my $dist = mySociety::Gaze::get_radius_containing_population( $params{latitude}, $params{longitude}, 200_000 ); - my $default_zoom = ZOOM_LEVELS - 3; - $default_zoom = ZOOM_LEVELS - 2 if $dist < 10; + my $default_zoom = $numZoomLevels - 3; + $default_zoom = $numZoomLevels - 2 if $dist < 10; # Map centre may be overridden in the query string $params{latitude} = Utils::truncate_coordinate($c->req->params->{lat} + 0) @@ -63,9 +70,9 @@ sub display_map { if defined $c->req->params->{lon}; my $zoom = defined $c->req->params->{zoom} ? $c->req->params->{zoom} + 0 : $default_zoom; - $zoom = ZOOM_LEVELS - 1 if $zoom >= ZOOM_LEVELS; + $zoom = $numZoomLevels - 1 if $zoom >= $numZoomLevels; $zoom = 0 if $zoom < 0; - my $zoom_act = MIN_ZOOM_LEVEL + $zoom; + my $zoom_act = $zoomOffset + $zoom; my ($x_tile, $y_tile) = latlon_to_tile_with_adjust($params{latitude}, $params{longitude}, $zoom_act); foreach my $pin (@{$params{pins}}) { @@ -82,7 +89,8 @@ sub display_map { y_tile => $y_tile, zoom => $zoom, zoom_act => $zoom_act, - zoom_levels => ZOOM_LEVELS, + zoomOffset => $zoomOffset, + numZoomLevels => $numZoomLevels, compass => compass( $x_tile, $y_tile, $zoom_act ), }; } @@ -158,6 +166,7 @@ sub click_to_tile { # Given some click co-ords (the tile they were on, and where in the # tile they were), convert to WGS84 and return. +# XXX Note use of MIN_ZOOM_LEVEL here. sub click_to_wgs84 { my ($self, $c, $pin_tile_x, $pin_x, $pin_tile_y, $pin_y) = @_; my $tile_x = click_to_tile($pin_tile_x, $pin_x); diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm index 3dd4e84e9..1391254b6 100644 --- a/perllib/FixMyStreet/TestMech.pm +++ b/perllib/FixMyStreet/TestMech.pm @@ -14,7 +14,6 @@ use Test::More; use Web::Scraper; use Carp; use Email::Send::Test; -use Digest::SHA1 'sha1_hex'; use JSON; =head1 NAME @@ -89,18 +88,18 @@ sub log_in_ok { my $user = $mech->create_user_ok($email); # store the old password and then change it - my $old_password_sha1 = $user->password; - $user->update( { password => sha1_hex('secret') } ); + my $old_password = $user->password; + $user->update( { password => 'secret' } ); # log in $mech->get_ok('/auth'); $mech->submit_form_ok( - { with_fields => { email => $email, password => 'secret' } }, - "login using form" ); + { with_fields => { email => $email, password_sign_in => 'secret' } }, + "sign in using form" ); $mech->logged_in_ok; # restore the password (if there was one) - $user->update( { password => $old_password_sha1 } ) if $old_password_sha1; + $user->update( { password => $old_password } ) if $old_password; return $user; } @@ -115,7 +114,7 @@ Log out the current user sub log_out_ok { my $mech = shift; - $mech->get_ok('/auth/logout'); + $mech->get_ok('/auth/sign_out'); $mech->not_logged_in_ok; } diff --git a/t/app/controller/alert_new.t b/t/app/controller/alert_new.t index 5bf7e31dd..d0976b4bb 100644 --- a/t/app/controller/alert_new.t +++ b/t/app/controller/alert_new.t @@ -193,8 +193,8 @@ foreach my $test ( foreach my $test ( { desc => 'logged in user signing up', - user => 'test-login@example.com', - email => 'test-login@example.com', + user => 'test-sign-in@example.com', + email => 'test-sign-in@example.com', type => 'council', param1 => 2651, param2 => 2651, @@ -203,7 +203,7 @@ foreach my $test ( { desc => 'logged in user signing up with different email', user => 'loggedin@example.com', - email => 'test-login@example.com', + email => 'test-sign-in@example.com', type => 'council', param1 => 2651, param2 => 2651, diff --git a/t/app/controller/auth.t b/t/app/controller/auth.t index 79db69704..8fbc413ec 100644 --- a/t/app/controller/auth.t +++ b/t/app/controller/auth.t @@ -38,7 +38,7 @@ for my $test ( { form_name => 'general_auth', fields => { email => $email, }, - button => 'email_login', + button => 'email_sign_in', }, "try to create an account with email '$email'" ); @@ -53,7 +53,7 @@ $mech->submit_form_ok( { form_name => 'general_auth', fields => { email => $test_email, }, - button => 'email_login', + button => 'email_sign_in', }, "create an account for '$test_email'" ); @@ -100,7 +100,7 @@ $mech->not_logged_in_ok; $mech->not_logged_in_ok; } -# get a login email and change password +# get a sign in email and change password { $mech->clear_emails_ok; $mech->get_ok('/auth'); @@ -111,9 +111,9 @@ $mech->not_logged_in_ok; email => "$test_email", r => 'faq', # Just as a test }, - button => 'email_login', + button => 'email_sign_in', }, - "email_login with '$test_email'" + "email_sign_in with '$test_email'" ); # rest is as before so no need to test @@ -182,19 +182,19 @@ $mech->not_logged_in_ok; } foreach my $remember_me ( '1', '0' ) { - subtest "login using valid details (remember_me => '$remember_me')" => sub { + subtest "sign in using valid details (remember_me => '$remember_me')" => sub { $mech->get_ok('/auth'); $mech->submit_form_ok( { form_name => 'general_auth', fields => { email => $test_email, - password => $test_password, + password_sign_in => $test_password, remember_me => ( $remember_me ? 1 : undef ), }, - button => 'login', + button => 'sign_in', }, - "login with '$test_email' & '$test_password" + "sign in with '$test_email' & '$test_password" ); is $mech->uri->path, '/my', "redirected to correct page"; @@ -210,18 +210,18 @@ foreach my $remember_me ( '1', '0' ) { }; } -# try to login with bad details +# try to sign in with bad details $mech->get_ok('/auth'); $mech->submit_form_ok( { form_name => 'general_auth', fields => { email => $test_email, - password => 'not the password', + password_sign_in => 'not the password', }, - button => 'login', + button => 'sign_in', }, - "login with '$test_email' & '$test_password" + "sign in with '$test_email' & '$test_password" ); is $mech->uri->path, '/auth', "redirected to correct page"; $mech->content_contains( 'Email or password wrong', 'found error message' ); diff --git a/t/app/controller/my.t b/t/app/controller/my.t index 1ed6806a4..da509e8ed 100644 --- a/t/app/controller/my.t +++ b/t/app/controller/my.t @@ -7,9 +7,9 @@ use FixMyStreet::TestMech; my $mech = FixMyStreet::TestMech->new; $mech->get_ok('/my'); -is $mech->uri->path, '/auth', "got sent to the login page"; +is $mech->uri->path, '/auth', "got sent to the sign in page"; -# login +# sign in my $user = $mech->log_in_ok( 'test@example.com' ); $mech->get_ok('/my'); is $mech->uri->path, '/my', "stayed on '/my/' page"; diff --git a/t/app/controller/report_import.t b/t/app/controller/report_import.t index 154de13d8..ba73b2555 100644 --- a/t/app/controller/report_import.t +++ b/t/app/controller/report_import.t @@ -119,7 +119,6 @@ subtest "Submit a correct entry" => sub { is_deeply $mech->visible_form_values, { name => 'Test User', - email => 'test@example.com', title => 'Test report', detail => 'This is a test report', photo => '', @@ -134,7 +133,6 @@ subtest "Submit a correct entry" => sub { { with_fields => { name => 'New Test User', - email => 'test@example.com', title => 'New Test report', detail => 'This is a test report', phone => '01234 567 890', @@ -193,14 +191,13 @@ subtest "Submit a correct entry (with location)" => sub { # go to the token url $mech->get_ok($token_url); - # check that we are on '/around' - is $mech->uri->path, '/report/new', "sent to /around"; + # check that we are on '/report/new' + is $mech->uri->path, '/report/new', "sent to /report/new"; # check that fields are prefilled for us is_deeply $mech->visible_form_values, { name => 'Test User ll', - email => 'test-ll@example.com', title => 'Test report ll', detail => 'This is a test report ll', photo => '', @@ -215,7 +212,6 @@ subtest "Submit a correct entry (with location)" => sub { { with_fields => { name => 'New Test User ll', - email => 'test-ll@example.com', title => 'New Test report ll', detail => 'This is a test report ll', phone => '01234 567 890', diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index 01c29ecf4..3e486d22c 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -406,7 +406,6 @@ foreach my $test ( title => '', detail => '', may_show_name => '1', - email => $test_email, name => 'Test User', phone => '01234 567 890', photo => '', diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index 5d6f902e3..f0916610b 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -775,7 +775,6 @@ foreach my $test ( alert => 1, # we signed up for alerts before, do not unsign us anonymous => 0, answered => 0, - login => 1, path => '/report/update', content => "Thanks, glad to hear it's been fixed! Could we just ask if you have ever reported a problem to a council before?", @@ -803,7 +802,6 @@ foreach my $test ( alert => 1, # we signed up for alerts before, do not unsign us anonymous => 0, answered => 1, - login => 1, path => '/report/' . $report->id, content => $report->title, }, diff --git a/templates/web/default/around/display_location.html b/templates/web/default/around/display_location.html index 88300113b..aa1dc86d6 100755 --- a/templates/web/default/around/display_location.html +++ b/templates/web/default/around/display_location.html @@ -23,7 +23,6 @@ pc => pc latitude => short_latitude, longitude => short_longitude, - submit_map => 1, skipped => 1, } ); @@ -37,7 +36,6 @@ %] <form action="[% c.uri_for('/report/new') %]" method="post" name="mapForm" id="mapForm"> -<input type="hidden" name="submit_map" value="1"> <input type="hidden" name="map" value="[% c.req.params.map | html %]"> <input type="hidden" name="pc" value="[% pc | html %]"> [% c.cobrand.form_elements('mapForm') %] diff --git a/templates/web/default/auth/change_password.html b/templates/web/default/auth/change_password.html index 2dd37cb91..be7c14e43 100644 --- a/templates/web/default/auth/change_password.html +++ b/templates/web/default/auth/change_password.html @@ -3,7 +3,7 @@ <h1>[% loc('Change Password') %]</h1> [% IF password_changed %] - <p>Your password has been changed!</p> + <p id="fixed">[% loc('Your password has been changed') %]</p> [% END %] diff --git a/templates/web/default/auth/general.html b/templates/web/default/auth/general.html index 5a5e63480..d30fefcee 100644 --- a/templates/web/default/auth/general.html +++ b/templates/web/default/auth/general.html @@ -1,6 +1,6 @@ [% INCLUDE 'header.html', title = loc('Sign in or create an account') %] -<h1>[% loc('Sign in or create an account') %]</h1> +<h1>[% loc('Sign in') %]</h1> <form action="[% c.uri_for() %]" method="post" name="general_auth"> <input type="hidden" name="r" value="[% c.req.params.r | html %]"> @@ -17,42 +17,66 @@ loc_email_error = errors.$email_error || errors.other; END %] - - <div id="fieldset"> + [% IF loc_email_error %] + <div class="form-error">[% loc_email_error %]</div> + [% ELSIF sign_in_error %] + <div class="form-error">[% loc('Email or password wrong - please try again.') %]</div> + [% END %] - [% IF loc_email_error %] - <div class="form-error">[% loc_email_error %]</div> - [% ELSIF login_error %] - <div class="form-error">Email or password wrong - please try again.</div> - [% END %] + <div class="form-field"> + <label class="n" for="email">[% loc('Your email address:') %]</label> + <input type="email" size="30" id="email" name="email" value="[% email | html %]"> + </div> - <div class="form-field"> - <label for="email">[% loc('Email:') %]</label> - <input type="text" name="email" value="[% email || '' | html %]"> - </div> +<div id="form_sign_in"> + <h3>[% loc("Do you have a FixMyStreet password?") %]</h3> - <div class="form-field"> - <label for="password">[% loc('Password:') %]</label> - <input type="password" name="password" value=""> - </div> + <div id="form_sign_in_yes"> - <div class="checkbox"> + <p> + <label class="n" for="password_sign_in">[% loc('<strong>Yes</strong>, I have a password:') %]</label> + <input type="password" name="password_sign_in" id="password_sign_in" value=""> + </p> + + <p> <input type="checkbox" name="remember_me" value='1'[% ' checked' IF remember_me %]> - <label for="remember_me"> - [% loc('Remember me - do not use on a public computer') %] + <label class="n" for="remember_me"> + [% loc('Keep me signed in on this computer') %] </label> - </div> + </p> - <div class="checkbox"> - <input type="submit" name="login" value="[% loc('Sign me in') %]"> - </div> + <p> + <input type="submit" name="sign_in" value="[% loc('Sign in') %]"> + </p> - <h3>I don't have an account, or I've forgotten my password...</h3> - <div class="checkbox"> - <input type="submit" name="email_login" value="[% loc('Email the details I need to the address I entered above') %]"> + </div> + <div id="form_sign_in_no"> + + <p>[% loc('<strong>No</strong>, I do not, let me sign in by email:') %]</p> + + <div id="fieldset"> + <div class="form-field"> + <label for="name">[% loc('Your name:') %]</label> + <input type="text" name="name" value=""> + </div> + + <div class="form-field"> + <label for="password_register">[% loc('Enter a new password:') %]</label> + <input type="password" name="password_register" id="password_register" value=""> + </div> </div> + <p><small>Providing a name and password is optional, but doing so + will allow you to more easily report problems, leave updates and + manage your reports.</small></p> + + <p> + <input type="submit" name="email_sign_in" value="[% loc('Sign in by email') %]"> + </p> + </div> + +</div> </form> diff --git a/templates/web/default/auth/logout.html b/templates/web/default/auth/sign_out.html index 3d8df60e4..3d8df60e4 100644 --- a/templates/web/default/auth/logout.html +++ b/templates/web/default/auth/sign_out.html diff --git a/templates/web/default/maps/openlayers.html b/templates/web/default/maps/openlayers.html index ae670ce13..7da732913 100644 --- a/templates/web/default/maps/openlayers.html +++ b/templates/web/default/maps/openlayers.html @@ -12,6 +12,8 @@ var fixmystreet = { [% IF map.zoom -%] 'zoom': [% map.zoom %], [%- END %] + 'numZoomLevels': [% map.numZoomLevels %], + 'zoomOffset': [% map.zoomOffset %], 'map_type': [% map.map_type %], 'pins': [% INCLUDE maps/pins_js.html %] } @@ -51,9 +53,9 @@ var fixmystreet = { east = c.uri_with( { lat = map.compass.east.0, lon = map.compass.east.1, zoom = map.zoom } ) west = c.uri_with( { lat = map.compass.west.0, lon = map.compass.west.1, zoom = map.zoom } ) world = c.uri_with( { zoom = 0 } ); - SET zoom_in = c.uri_with( { zoom = map.zoom + 1 } ) IF map.zoom < map.zoom_levels - 1; + SET zoom_in = c.uri_with( { zoom = map.zoom + 1 } ) IF map.zoom < map.numZoomLevels - 1; SET zoom_out = c.uri_with( { zoom = map.zoom - 1 } ) IF map.zoom > 0; - SET zoom_in = '#' IF map.zoom >= map.zoom_levels - 1; + SET zoom_in = '#' IF map.zoom >= map.numZoomLevels - 1; SET zoom_out = '#' IF map.zoom <= 0; %] <div style="position: absolute; left: 4px; top: 4px; z-index: 1007;" class="olControlPanZoom olControlNoSelect" unselectable="on"> diff --git a/templates/web/default/report/display.html b/templates/web/default/report/display.html index 38c3014fa..25f3892a6 100644 --- a/templates/web/default/report/display.html +++ b/templates/web/default/report/display.html @@ -129,7 +129,7 @@ <small>[% loc('(we never show your email)') %]</small> </div> -[% IF NOT c.user %] +[% IF NOT c.user_exists %] [% IF field_errors.email %] <div class='form-error'>[% field_errors.email %]</div> diff --git a/templates/web/default/report/new/fill_in_details.html b/templates/web/default/report/new/fill_in_details.html index 48407bb45..4a40dd707 100644 --- a/templates/web/default/report/new/fill_in_details.html +++ b/templates/web/default/report/new/fill_in_details.html @@ -141,14 +141,18 @@ <small>[% loc('(we never show your email address or phone number)') %]</small> </div> -[% IF field_errors.email %] - <div class='form-error'>[% field_errors.email %]</div> -[% END %] +[% IF NOT c.user_exists %] -<div class="form-field"> - <label for="form_email">[% loc('Email:') %]</label> - <input type="text" value="[% report.user.email | html %]" name="email" id="form_email" size="25"> -</div> + [% IF field_errors.email %] + <div class='form-error'>[% field_errors.email %]</div> + [% END %] + + <div class="form-field"> + <label for="form_email">[% loc('Email:') %]</label> + <input type="text" value="[% report.user.email | html %]" name="email" id="form_email" size="25"> + </div> + +[% END %] <div> <label for="form_phone">[% loc('Phone:') %]</label> diff --git a/templates/web/default/report/new/notes.html b/templates/web/default/report/new/notes.html index 38c8bfb7b..be605ddaa 100644 --- a/templates/web/default/report/new/notes.html +++ b/templates/web/default/report/new/notes.html @@ -1,4 +1,4 @@ -<p>[% loc("Please note:") %]</p> +<p style="clear:both">[% loc("Please note:") %]</p> <ul> diff --git a/web/css/core.css b/web/css/core.css index 39f448b8c..937bf533d 100644 --- a/web/css/core.css +++ b/web/css/core.css @@ -113,7 +113,22 @@ background-color: #ccffcc; border: solid 2px #009900; padding: 5px; - text-align: center; } + text-align: center; +} +#mysociety #form_sign_in_yes { + float: left; + width: 47%; + padding-right: 1%; + border-right: solid 1px #999999; + margin-bottom: 1em; +} +#mysociety #form_sign_in_no, #mysociety #fieldset #form_sign_in_no { + float: right; + width: 47%; + padding-left: 1%; + clear: none; + margin-bottom: 1em; +} #mysociety #watermark { background: url("/i/mojwatermark6.png"); height: 113px; diff --git a/web/css/core.scss b/web/css/core.scss index 1c9d5f451..cbf15f16b 100644 --- a/web/css/core.scss +++ b/web/css/core.scss @@ -189,6 +189,22 @@ $map_width: 500px; text-align: center; } + #form_sign_in_yes { + float: left; + width: 47%; + padding-right: 1%; + border-right: solid 1px #999999; + margin-bottom: 1em; + } + + #form_sign_in_no, #fieldset #form_sign_in_no { + float: right; + width: 47%; + padding-left: 1%; + clear: none; + margin-bottom: 1em; + } + // Map #watermark { diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js index 22492e400..83e535f1c 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -1,7 +1,5 @@ YAHOO.util.Event.onContentReady('map', function() { - fixmystreet.ZOOM_OFFSET = 13; - var perm = new OpenLayers.Control.Permalink(); set_map_config(perm); @@ -11,9 +9,9 @@ YAHOO.util.Event.onContentReady('map', function() { }); fixmystreet.layer_options = OpenLayers.Util.extend({ - zoomOffset: fixmystreet.ZOOM_OFFSET, + zoomOffset: fixmystreet.zoomOffset, transitionEffect: 'resize', - numZoomLevels: 5 + numZoomLevels: fixmystreet.numZoomLevels }, fixmystreet.layer_options); var layer = new fixmystreet.map_type("", fixmystreet.layer_options); fixmystreet.map.addLayer(layer); diff --git a/web/js/map-bing-ol.js b/web/js/map-bing-ol.js index 00c3a487f..c3c3b994e 100644 --- a/web/js/map-bing-ol.js +++ b/web/js/map-bing-ol.js @@ -1,5 +1,4 @@ function set_map_config(perm) { - fixmystreet.ZOOM_OFFSET = 13; fixmystreet.controls = [ new OpenLayers.Control.ArgParser(), new OpenLayers.Control.Navigation(), |