| Jifty documentation | Contained in the Jifty distribution. |
Jifty::Plugin::Authentication::Password::View - views for password plugin
This provides the templates for the pages and forms used by the password authentication plugin.
Displays a sign-up form.
Displays the login form.
A handy template for embedding the login form. Just include it in your templates via:
show('/login_widget');
After requesting a password reset and clicking on the link sent by email, this receives that click and provides the form for resetting the password.
See Jifty::Plugin::Authentication::Action::ResetLostPassword.
Handles the work of confirming an email address for a new account.
See Jifty::Plugin::Authenticaiton::Password::View.
Starts the process of sending a link to reset a lost password by email.
See Jifty::Plugin::Authentication::Password::SendPasswordReminder.
Request a new email confirmation message be sent to your email account.
See Jifty::Plugin::Authentication::Password::Action::ResendConfirmation.
Jifty is Copyright 2005-2010 Best Practical Solutions, LLC. Jifty is distributed under the same terms as Perl itself.
| Jifty documentation | Contained in the Jifty distribution. |
use warnings; use strict;
package Jifty::Plugin::Authentication::Password::View; use Jifty::View::Declare -base;
template 'signup' => page { title => _('Sign up') } content { my ( $action, $next ) = get(qw(action next)); Jifty->web->form->start( call => $next ); render_param( $action => 'name' , focus => 1); render_param( $action => $_ ) for ( grep {$_ ne 'name'} $action->argument_names ); form_return( label => _('Sign up'), submit => $action ); Jifty->web->form->end(); };
template login => page { title => _('Login!') } content { show('/login_widget'); };
template login_widget => sub { my ( $action, $next ) = get( 'action', 'next' ); $action ||= new_action( class => 'Login' ); $next ||= Jifty::Continuation->new( request => Jifty::Request->new( path => "/" ) ); unless ( Jifty->web->current_user->id ) { p { outs( _( "No account yet? It's quick and easy. " )); tangent( label => _("Sign up for an account!"), url => '/signup'); }; h3 { _('Login with a password') }; div { attr { id => 'jifty-login' }; Jifty->web->form->start( call => $next ); if ($action->login_by eq 'username' ) { render_param( $action, 'username', focus => 1 ); } else { render_param( $action, 'email', focus => 1 ); }; render_param( $action, $_ ) for (qw(password remember)); form_return( label => _(q{Login}), submit => $action ); hyperlink( label => _("Lost your password?"), url => "/lost_password" ); Jifty->web->form->end(); }; } else { outs( _("You're already logged in.") ); } };
template 'let/reset_lost_password' => page { title => _('Reset lost password') } content { my ( $next ) = get(qw(next)); my $action = Jifty->web->new_action( class => 'ResetLostPassword' ); h1 { {class is 'title'}; _('Reset lost password')}; Jifty->web->form->start( call => $next ); render_param( $action => $_ ) for ( $action->argument_names ); form_return( label => _("New password"), submit => $action ); Jifty->web->form->end(); };
template 'let/confirm_email' => sub { new_action( class => 'ConfirmEmail' )->run; redirect("/"); };
template 'lost_password' => page { title => 'Send a link to reset your password' } content { my ( $next ) = get(qw(next)); my $action = Jifty->web->new_action( moniker => 'password_reminder', class => 'SendPasswordReminder', ); h1 { {class is 'title'}; _('Send a link to reset your password')}; outs( _( "You lost your password. A link to reset it will be sent to the following email address:")); my $focused = 0; Jifty->web->form->start( call => $next ); render_param( $action => $_, focus => $focused++ ? 0 : 1 ) for ( $action->argument_names ); form_return( label => _(q{Send}), submit => $action); Jifty->web->form->end; };
template 'resend_confirmation' => page { title => 'Resend Confirmation Email' } content { my $resend = Jifty->web->new_action( class => 'ResendConfirmation', moniker => 'resendconf' ); if ( Jifty->web->current_user->id and Jifty->web->current_user->user_object->email_confirmed ) { Jifty->web->redirect('/'); } else { div { attr { id => 'overview' }; form { Jifty->web->form->next_page( url => '/' ); p { _( q{Fill in your address below, and we'll send out another confirmation email to you. } ); render_param( $resend => 'email', focus => 1 ); form_submit( label => 'Resend Confirmation' ); } } } } };
1;