]> Dogcows Code - chaz/chatty/commitdiff
better client-side form validation; layout tweaks
authorCharles McGarvey <chazmcgarvey@brokenzipper.com>
Thu, 20 Oct 2011 01:23:55 +0000 (19:23 -0600)
committerCharles McGarvey <chazmcgarvey@brokenzipper.com>
Thu, 20 Oct 2011 01:25:30 +0000 (19:25 -0600)
12 files changed:
Makefile.PL
lib/Chatty/Controller/Root.pm
lib/Chatty/Form/Login.pm
lib/Chatty/Form/Register.pm
root/static/css/common.css
root/static/css/validationEngine.jquery.css
root/static/img/chat.png [new file with mode: 0644]
root/static/js/jquery.validationEngine-en.js
root/tt/index.tt [deleted file]
root/tt/login.tt
root/tt/register.tt
root/tt/wrapper.tt

index c5c28ca73444a3c8029e0763201cf6aadda25bbd..baf385c7c352e964767e2fc246412d7f9488bacd 100644 (file)
@@ -19,6 +19,7 @@ requires 'Catalyst::Plugin::Session::Store::FastMmap';
 requires 'Catalyst::Plugin::Session::State::Cookie';
 requires 'Catalyst::Plugin::Unicode::Encoding';
 requires 'Catalyst::Action::RenderView';
+requires 'JSON';
 requires 'Moose';
 requires 'namespace::autoclean';
 requires 'Config::General'; # This should reflect the config file format you've chosen
index ab0bfcd8ee1e07d6f48e1cbad556553552f10e30..f526d4152aa3e4e2a76e19d866604573fc96b737 100644 (file)
@@ -10,6 +10,8 @@ BEGIN { extends 'Catalyst::Controller' }
 #
 __PACKAGE__->config(namespace => '');
 
+use JSON 'encode_json';
+
 use Chatty::Form::Login;
 use Chatty::Form::Register;
 
@@ -44,7 +46,9 @@ The root page (/)
 =cut
 
 sub index :Path :Args(0) {
-       my ( $self, $c ) = @_;
+       my ($self, $c) = @_;
+       $c->go('/chat/list') if ($c->user_exists);
+       $c->go('login');
 }
 
 =head2 login
@@ -68,13 +72,12 @@ sub login :Local :Args(0) {
                        $c->change_session_id;
                        my $user = $c->user->get('username');
                        $c->flash->{message} .= "Hi, $user! You are now logged in.";
-                       $c->response->redirect($c->uri_for('/'));
+                       $c->res->redirect($c->uri_for_action('index'));
+                       return;
                }
-               else {
-                       $c->flash->{error} = "Log-in failed! Try again, I guess.";
-                       $c->response->redirect($c->uri_for('login'));
-               }
-       }
+       };
+       $c->flash->{error} = "Log-in failed! Try again, I guess.";
+       $c->res->redirect($c->uri_for_action('login'));
 }
 
 =head2 logout
@@ -89,7 +92,7 @@ sub logout :Local :Args(0) {
                $c->logout;
                $c->flash->{message} = "Goodbye! You have been logged out.";
        }
-       $c->response->redirect($c->uri_for('/'));
+       $c->res->redirect($c->uri_for_action('index'));
 }
 
 =head2 register
@@ -109,12 +112,71 @@ sub register :Local :Args(0) {
                params  => $c->req->params
        );
 
-       return unless $self->register_form->is_valid;
+       if (!$self->register_form->is_valid) {
+               if ($c->req->method eq 'POST') {
+                       $c->stash->{error} = "The form has a validation error. Try again...";
+               }
+               return;
+       }
 
        $c->flash->{message} = "Registration complete. ";
        $c->forward('login');
 }
 
+=head2 register_validate
+
+Check whether or not a username is available.
+
+=cut
+
+sub register_validate :Local :Args(0) {
+       my ($self, $c) = @_;
+
+       my $id = $c->req->param('fieldId');
+       my $username = $c->req->param('fieldValue');
+
+       my $json_arr = [];
+
+       if ($username) {
+               my $account = $c->model('DB::Account')->find({username => $username});
+               if (!$account) {
+                       $json_arr = ["$id", 1, "This username is available. Nice!"];
+               }
+               else {
+                       $json_arr = ["$id", 0, "This username is taken."];
+               }
+       }
+       else {
+               $json_arr = ["$id", 0, "Invalid arguments to check script."];
+       }
+       $c->res->content_type("application/json");
+       $c->res->body(encode_json($json_arr));
+}
+
+=head2 access_denied
+
+Standard 403 error page
+
+=cut
+
+sub access_denied :Private {
+       my ($self, $c) = @_;
+       $c->res->body('Access denied.');
+       $c->res->status(403);
+}
+
+=head2 missing
+
+Standard 404 error page
+
+=cut
+
+sub missing :Private {
+       my ($self, $c) = @_;
+       $c->res->body('Page not found.');
+       $c->res->status(404);
+}
+
 =head2 default
 
 Standard 404 error page
@@ -123,8 +185,7 @@ Standard 404 error page
 
 sub default :Path {
        my ($self, $c) = @_;
-       $c->response->body('Page not found.');
-       $c->response->status(404);
+       $c->detach('missing');
 }
 
 =head2 end
index aa25b1d89ac7c79998afc68b1793a4789c04392c..6e881695a7b68eceee9f4089f2102b41ed54137d 100644 (file)
@@ -2,11 +2,11 @@ package Chatty::Form::Login;
 
 use HTML::FormHandler::Moose;
 extends 'HTML::FormHandler';
+use namespace::autoclean;
 
 has_field 'username' => (label => 'Username', required => 1);
 has_field 'password' => (type => 'Password', required => 1);
 has_field 'submit' => (type => 'Submit', value => 'Login');
 
-no HTML::FormHandler::Moose;
 __PACKAGE__->meta->make_immutable;
 1;
index 9ae939ef31231833e7afbaa5ecdf4f45606f9f17..bf0ec64979975e46f8907b0456c1f69f499ae986 100644 (file)
@@ -2,19 +2,19 @@ package Chatty::Form::Register;
 
 use HTML::FormHandler::Moose;
 extends 'HTML::FormHandler::Model::DBIC';
+use namespace::autoclean;
 
 has '+item_class' => (default => 'Account');
-
-has_field 'username' => (label => 'User Nickname', required => 1, unique => 1);
-has_field 'password' => (type => 'Password', required => 1);
-has_field 'password_confirm' => (type => 'PasswordConf', required => 1);
-has_field 'email' => (type => 'Email', label => 'Email address');
-has_field 'submit' => (type => 'Submit', value => 'Register');
-
 has '+unique_messages' => (default => sub {
                {username => 'Username is already registered'};
-       });
+});
+
+has_field 'username' => (input_class => 'validate[required,ajax[register_validate]]', label => 'Username', required => 1, unique => 1);
+has_field 'password' => (input_class => 'validate[required]', type => 'Password', required => 1);
+has_field 'password_confirm' => (input_class => 'validate[required,equals[password]]', type => 'PasswordConf', required => 1);
+has_field 'email' => (input_class => 'validate[custom[email]]', type => 'Email', label => 'Email address');
+has_field 'submit' => (type => 'Submit', value => 'Register');
+has_field 'reset' => (type => 'Reset', value => 'Reset');
 
-no HTML::FormHandler::Moose;
 __PACKAGE__->meta->make_immutable;
 1;
index 023d30e255d13b47b6d25ead20702370d25f5dad..6474f5bda4a7991fca885e05a8876ee15736a3fe 100644 (file)
@@ -50,6 +50,7 @@ label {
        margin: 5px;
        padding: 10px;
        border: 2px solid black;
+       border-radius: 5px;
        background: white;
 }
 
@@ -62,7 +63,7 @@ label {
 }
 
 #footer {
-       padding: 0;
+       padding: 10px 0 0 0;
        height: 31px;
        line-height: 31px;
        font-size: 0.8em;
@@ -95,3 +96,8 @@ label {
        background: #c66;
 }
 
+form div {
+       height: 32px;
+       line-height: 32px;
+}
+
index 5500bee618a1e6117fa41afae4c9d3c815286de2..b733ad32487e942c9c0f91afc5406f873106316b 100755 (executable)
@@ -25,7 +25,7 @@
        position:relative;\r
        z-index:5001;\r
        color: #fff;\r
-       width: 150px;\r
+       width: 175px;\r
        font-family: tahoma;\r
        font-size: 11px;\r
        border: 2px solid #ddd;\r
diff --git a/root/static/img/chat.png b/root/static/img/chat.png
new file mode 100644 (file)
index 0000000..3e1af26
Binary files /dev/null and b/root/static/img/chat.png differ
index 2a2b70f3a09c4cd609dcb7730423c78bbb344d7e..2a3085a344c2930c9821724b108126308443b018 100644 (file)
             $.validationEngineLanguage.allRules = {\r
                 "required": { // Add your regex rules here, you can take telephone as an example\r
                     "regex": "none",\r
-                    "alertText": "* This field is required",\r
-                    "alertTextCheckboxMultiple": "* Please select an option",\r
-                    "alertTextCheckboxe": "* This checkbox is required",\r
-                    "alertTextDateRange": "* Both date range fields are required"\r
+                    "alertText": "This field is required.",\r
+                    "alertTextCheckboxMultiple": "Please select an option.",\r
+                    "alertTextCheckboxe": "This checkbox is required.",\r
+                    "alertTextDateRange": "Both date range fields are required."\r
                 },\r
                 "dateRange": {\r
                     "regex": "none",\r
-                    "alertText": "Invalid ",\r
+                    "alertText": "Invalid ",\r
                     "alertText2": "Date Range"\r
                 },\r
                 "dateTimeRange": {\r
                     "regex": "none",\r
-                    "alertText": "Invalid ",\r
+                    "alertText": "Invalid ",\r
                     "alertText2": "Date Time Range"\r
                 },\r
                 "minSize": {\r
                     "regex": "none",\r
-                    "alertText": "Minimum ",\r
+                    "alertText": "Minimum ",\r
                     "alertText2": " characters allowed"\r
                 },\r
                 "maxSize": {\r
                     "regex": "none",\r
-                    "alertText": "Maximum ",\r
+                    "alertText": "Maximum ",\r
                     "alertText2": " characters allowed"\r
                 },\r
                                "groupRequired": {\r
                     "regex": "none",\r
-                    "alertText": "* You must fill one of the following fields"\r
+                    "alertText": "You must fill one of the following fields."\r
                 },\r
                 "min": {\r
                     "regex": "none",\r
-                    "alertText": "Minimum value is "\r
+                    "alertText": "Minimum value is "\r
                 },\r
                 "max": {\r
                     "regex": "none",\r
-                    "alertText": "Maximum value is "\r
+                    "alertText": "Maximum value is "\r
                 },\r
                 "past": {\r
                     "regex": "none",\r
-                    "alertText": "Date prior to "\r
+                    "alertText": "Date prior to "\r
                 },\r
                 "future": {\r
                     "regex": "none",\r
-                    "alertText": "Date past "\r
+                    "alertText": "Date past "\r
                 },     \r
                 "maxCheckbox": {\r
                     "regex": "none",\r
-                    "alertText": "Maximum ",\r
+                    "alertText": "Maximum ",\r
                     "alertText2": " options allowed"\r
                 },\r
                 "minCheckbox": {\r
                     "regex": "none",\r
-                    "alertText": "Please select ",\r
+                    "alertText": "Please select ",\r
                     "alertText2": " options"\r
                 },\r
                 "equals": {\r
                     "regex": "none",\r
-                    "alertText": "* Fields do not match"\r
+                    "alertText": "Fields do not match."\r
                 },\r
                 "phone": {\r
                     // credit: jquery.h5validate.js / orefalo\r
                     "regex": /^([\+][0-9]{1,3}[ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,\r
-                    "alertText": "* Invalid phone number"\r
+                    "alertText": "Invalid phone number."\r
                 },\r
                 "email": {\r
                     // Shamelessly lifted from Scott Gonzalez via the Bassistance Validation plugin http://projects.scottsplayground.com/email_address_validation/\r
                     "regex": /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,\r
-                    "alertText": "* Invalid email address"\r
+                    "alertText": "Invalid email address."\r
                 },\r
                 "integer": {\r
                     "regex": /^[\-\+]?\d+$/,\r
-                    "alertText": "* Not a valid integer"\r
+                    "alertText": "Not a valid integer."\r
                 },\r
                 "number": {\r
                     // Number, including positive, negative, and floating decimal. credit: orefalo\r
                     "regex": /^[\-\+]?(([0-9]+)([\.,]([0-9]+))?|([\.,]([0-9]+))?)$/,\r
-                    "alertText": "* Invalid floating decimal number"\r
+                    "alertText": "Invalid floating decimal number."\r
                 },\r
                 "date": {\r
                     "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/,\r
-                    "alertText": "* Invalid date, must be in YYYY-MM-DD format"\r
+                    "alertText": "Invalid date, must be in YYYY-MM-DD format."\r
                 },\r
                 "ipv4": {\r
                     "regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/,\r
-                    "alertText": "* Invalid IP address"\r
+                    "alertText": "Invalid IP address."\r
                 },\r
                 "url": {\r
                     "regex": /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,\r
-                    "alertText": "* Invalid URL"\r
+                    "alertText": "Invalid URL."\r
                 },\r
                 "onlyNumberSp": {\r
                     "regex": /^[0-9\ ]+$/,\r
-                    "alertText": "* Numbers only"\r
+                    "alertText": "Numbers only."\r
                 },\r
                 "onlyLetterSp": {\r
                     "regex": /^[a-zA-Z\ \']+$/,\r
-                    "alertText": "* Letters only"\r
+                    "alertText": "Letters only."\r
                 },\r
                 "onlyLetterNumber": {\r
                     "regex": /^[0-9a-zA-Z]+$/,\r
-                    "alertText": "* No special characters allowed"\r
+                    "alertText": "No special characters allowed."\r
                 },\r
                 // --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings\r
                 "ajaxUserCall": {\r
                     "url": "ajaxValidateFieldUser",\r
                     // you may want to pass extra data on the ajax call\r
                     "extraData": "name=eric",\r
-                    "alertText": "* This user is already taken",\r
-                    "alertTextLoad": "* Validating, please wait"\r
+                    "alertText": "This user is already taken.",\r
+                    "alertTextLoad": "Validating, please wait..."\r
                 },\r
                                "ajaxUserCallPhp": {\r
                     "url": "phpajax/ajaxValidateFieldUser.php",\r
                     // you may want to pass extra data on the ajax call\r
                     "extraData": "name=eric",\r
                     // if you provide an "alertTextOk", it will show as a green prompt when the field validates\r
-                    "alertTextOk": "* This username is available",\r
-                    "alertText": "* This user is already taken",\r
-                    "alertTextLoad": "* Validating, please wait"\r
+                    "alertTextOk": "This username is available.",\r
+                    "alertText": "This user is already taken.",\r
+                    "alertTextLoad": "Validating, please wait..."\r
                 },\r
                 "ajaxNameCall": {\r
                     // remote json service location\r
                     "url": "ajaxValidateFieldName",\r
                     // error\r
-                    "alertText": "* This name is already taken",\r
+                    "alertText": "This name is already taken.",\r
                     // if you provide an "alertTextOk", it will show as a green prompt when the field validates\r
-                    "alertTextOk": "* This name is available",\r
+                    "alertTextOk": "This name is available.",\r
                     // speaks by itself\r
-                    "alertTextLoad": "* Validating, please wait"\r
+                    "alertTextLoad": "Validating, please wait..."\r
                 },\r
                                 "ajaxNameCallPhp": {\r
                            // remote json service location\r
                            "url": "phpajax/ajaxValidateFieldName.php",\r
                            // error\r
-                           "alertText": "* This name is already taken",\r
+                           "alertText": "This name is already taken.",\r
                            // speaks by itself\r
-                           "alertTextLoad": "* Validating, please wait"\r
+                           "alertTextLoad": "Validating, please wait..."\r
                        },\r
                 "validate2fields": {\r
-                    "alertText": "* Please input HELLO"\r
+                    "alertText": "Please input HELLO."\r
                 },\r
                    //tls warning:homegrown not fielded \r
                 "dateFormat":{\r
                     "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8]))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(0?2(\/|-)29)(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00)|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26]))$/,\r
-                    "alertText": "* Invalid Date"\r
+                    "alertText": "Invalid Date."\r
                 },\r
                 //tls warning:homegrown not fielded \r
                                "dateTimeFormat": {\r
                        "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1}$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^((1[012]|0?[1-9]){1}\/(0?[1-9]|[12][0-9]|3[01]){1}\/\d{2,4}\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1})$/,\r
-                    "alertText": "* Invalid Date or Date Format",\r
+                    "alertText": "Invalid Date or Date Format.",\r
                     "alertText2": "Expected Format: ",\r
                     "alertText3": "mm/dd/yyyy hh:mm:ss AM|PM or ", \r
                     "alertText4": "yyyy-mm-dd hh:mm:ss AM|PM"\r
-                   }\r
+                   },\r
+                "register_validate": {\r
+                    "url": "register_validate",\r
+                    "alertTextLoad": "Validating, please wait..."\r
+                },\r
             };\r
             \r
         }\r
     };\r
     $.validationEngineLanguage.newLang();\r
-})(jQuery);
\ No newline at end of file
+})(jQuery);\r
diff --git a/root/tt/index.tt b/root/tt/index.tt
deleted file mode 100644 (file)
index 06fce92..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<h1>Chatty - Toy chat app written in Perl/Catalyst</h1>
-<p>
-This app lets you chat with other registered chatters. Cool!  Once you are
-registered and logged-in, you will be allowed to join a chat room and get
-chatty.
-</p>
-[% IF ! c.user_exists -%]
-[% INCLUDE login.tt -%]
-[% ELSE %]
-<a href="[% c.uri_for('logout') %]">Log Out</a>
-[% END -%]
index 3720e2611122f7c388e1fd3c5856a8cf2c07a8bd..74eefa583257c4235aa9a65b0fec4a82efa4246d 100644 (file)
@@ -1,5 +1,10 @@
 [% META title = 'Log In' -%]
-<h2>Log In</h2>
+<p>
+This app lets you chat with other registered chatters. Cool!  Once you are
+registered and logged-in, you will be allowed to join a chat room and get
+chatty.
+</p>
+<h1>Log In</h1>
 [% IF ! c.user_exists -%]
 <!--
 <form action="[% c.uri_for('login')  %]" method="post">
 </form>
 -->
 [% form.render %]
-<h3>Register</h3>
+<h2>Register</h2>
 <p>
-If you don't already have an account, <a href="[% c.uri_for('register') %]">go register</a>!
+If you don't already have an account, you should
+<a href="[% c.uri_for('register') %]">go register</a> now!
 </p>
 [% ELSE -%]
 <p>You are already logged in.</p>
index c73e161a41964e920b9cfa05c2d95d2838cf33ea..250654b0c2ed1227146a06507cf4b787c4135857 100644 (file)
@@ -1,36 +1,12 @@
 [% META title = 'Register' -%]
 [% BLOCK js -%]
-$('#form').validationEngine();
-$('#form button[type=reset]').click(function() {
-       $('#form').validationEngine('hideAll');
+$('form').validationEngine();
+$('form input[type=reset]').click(function() {
+       $('form').validationEngine('hideAll');
 });
 [% END -%]
-<h2>Register</h2>
+<h1>Register</h1>
 [% IF ! c.user_exists -%]
-<!--
-<form id="form" action="[% c.uri_for('register') %]" method="post">
-       <fieldset>
-               <p>
-                       <label>Email</label>
-                       <input id="email" class="validate[custom[email]]" type="text" name="email">
-               </p>
-               <p>
-                       <label>Username*</label>
-                       <input id="handle" class="validate[required]" type="text" name="handle">
-               </p>
-               <p>
-                       <label>Password*</label>
-                       <input id="password1" class="validate[required]" type="password" name="password">
-               </p>
-               <p>
-                       <label>Confirm*</label>
-                       <input id="password2" class="validate[required]" type="password" name="password">
-               </p>
-               <button type="submit">Register</button>
-               <button type="reset">Reset</button>
-       </fieldset>
-</form>
--->
 [% form.render %]
 [% ELSE -%]
 <p>You are already registered and logged in.  There is no need to register again.</p>
index 6fad196f4d97108a65fce37dc85403d6812f773b..f4d497f9e55c81e9939d2c1b4a3d7ae63886ba02 100644 (file)
                        </div>
 [% END -%]
                        <div id="inner">
+                               <div class="right">
+[% IF c.user_exists -%]
+                                       <a href="[% c.uri_for_action('logout') %]">Log Out</a>
+[% END -%]
+                               </div>
+                               <img src="[% c.uri_for('/static/img/chat.png') %]" alt="Chat!">
 [% content -%]
-                               <hr>
                                <div id="footer">
                                        Copyright &copy; 2011 Charles McGarvey. Some rights reserved.
                                        <div class="right">
                                $('#message').delay(200).slideDown('fast');
                                setTimeout("$('#message').slideUp()", 5000);
 [% END -%]
-$.tools.validator.localize("en", {
-       ':email'                : 'Please enter a valid email address.',
-       '[required]'    : 'This field is required.'
-});
 [% TRY; INCLUDE js; CATCH; ''; END -%]
                        });
                </script>
This page took 0.049455 seconds and 4 git commands to generate.