[jifty-devel] Re: [Jifty-commit] r1951 - in jifty/trunk: plugins/Login/share/web/templates

John Peacock jpeacock at rowman.com
Mon Sep 11 12:28:39 EDT 2006


jifty-commit at lists.jifty.org wrote:
> Log:
>  r27366 at 113:  jesse | 2006-09-11 17:22:00 +0100
>  * Get the signup form in the login plugin to respect locally defined schema for the user class
> 

You'll also have to tweak:

	plugins/Login/lib/Jifty/Plugin/Login/Action/Signup.pm

which assumes too much about the makeup of the schema.  I was toying 
with something like this:

=== plugins/Login/lib/Jifty/Plugin/Login/Action/Signup.pm
==================================================================
--- plugins/Login/lib/Jifty/Plugin/Login/Action/Signup.pm 
(revision 1593)
+++ plugins/Login/lib/Jifty/Plugin/Login/Action/Signup.pm       (local)
@@ -32,6 +32,23 @@
      my $self = shift;
      my $args = $self->SUPER::arguments;

+    $args = $self->valid_arguments($args);
+    $args->{'email'}{'ajax_validates'}   = 1;
+    $args->{'password_confirm'}{'label'} = "Type that again?";
+    return $args;
+}
+
+=head2 valid_arguments
+
+Only permit display of selected arguments.  Override this in User
+subclasses where more than the default four fields should be displayed.
+
+=cut
+
+sub valid_arguments {
+    my $self = shift;
+    my $args = shift;
+
      my %fields = (
          name             => 1,
          email            => 1,
@@ -40,8 +57,7 @@
      );

      for ( keys %$args ) { delete $args->{$_} unless ( $fields{$_} ); }
-    $args->{'email'}{'ajax_validates'}   = 1;
-    $args->{'password_confirm'}{'label'} = "Type that again?";
+
      return $args;
  }


which provides an overridable method valid_arguments that could be used 
by a subclass to tailor the arg cleanup (there are certain fields in the 
schema which shouldn't be shown as arguments).

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD  20706
301-459-3366 x.5010
fax 301-429-5748


More information about the jifty-devel mailing list