[Rt-commit] r5989 - in commitbit: . trunk/lib/CommitBit/Model
trunk/lib/CommitBit/Notification trunk/share/web/templates/let
jesse at bestpractical.com
jesse at bestpractical.com
Tue Sep 19 06:09:34 EDT 2006
Author: jesse
Date: Tue Sep 19 06:09:20 2006
New Revision: 5989
Added:
commitbit/trunk/lib/CommitBit/Action/ConfirmEmail.pm
commitbit/trunk/share/web/templates/let/set_password
Modified:
commitbit/ (props changed)
commitbit/trunk/lib/CommitBit/Model/User.pm
commitbit/trunk/lib/CommitBit/Notification/InviteToProject.pm
Log:
r27667 at pinglin: jesse | 2006-09-19 12:07:01 +0200
* CommitBit no longer sends passwords in plaintext email
Added: commitbit/trunk/lib/CommitBit/Action/ConfirmEmail.pm
==============================================================================
--- (empty file)
+++ commitbit/trunk/lib/CommitBit/Action/ConfirmEmail.pm Tue Sep 19 06:09:20 2006
@@ -0,0 +1,55 @@
+use warnings;
+use strict;
+
+=head1 NAME
+
+CommitBit::Action::ConfirmEmail - Confirm a user's email address
+
+=head1 DESCRIPTION
+
+This is the link in a user's email to confirm that their email
+email is really theirs. It is not really meant to be rendered on any
+web page, but is used by the confirmation notification.
+
+=cut
+
+package CommitBit::Action::ConfirmEmail;
+use base qw/Jifty::Action/;
+
+=head2 actions
+
+A null sub, because the superclass wants to make sure we fill in actions
+
+=cut
+
+sub actions { }
+
+=head2 take_action
+
+Set their confirmed status.
+
+=cut
+
+sub take_action {
+ my $self = shift;
+ my $u = CommitBit::Model::User->new( current_user => CommitBit::CurrentUser->superuser );
+ $u->load_by_cols( email => Jifty->web->current_user->user_object->email );
+
+ if ( $u->email_confirmed ) {
+ $self->result->error(
+ email => "You have already confirmed your account." );
+ $self->result->success(1); # but the action is still a success
+ }
+
+ $u->set_email_confirmed('true');
+
+ # Set up our login message
+ $self->result->message( "Welcome to CommitBit."
+ . " Your email address has now been confirmed." );
+
+ # Actually do the login thing.
+ Jifty->web->current_user( CommitBit::CurrentUser->new( id => $u->id ) );
+ return 1;
+}
+
+1;
Modified: commitbit/trunk/lib/CommitBit/Model/User.pm
==============================================================================
--- commitbit/trunk/lib/CommitBit/Model/User.pm (original)
+++ commitbit/trunk/lib/CommitBit/Model/User.pm Tue Sep 19 06:09:20 2006
@@ -31,7 +31,6 @@
$args->{password} = $PASSWORD_GEN->generate;
}
# XXX TODO, confirm email addresses always
- $args->{'email_confirmed'} = 'true';
return $self->SUPER::create(%$args);
}
Modified: commitbit/trunk/lib/CommitBit/Notification/InviteToProject.pm
==============================================================================
--- commitbit/trunk/lib/CommitBit/Notification/InviteToProject.pm (original)
+++ commitbit/trunk/lib/CommitBit/Notification/InviteToProject.pm Tue Sep 19 06:09:20 2006
@@ -32,31 +32,32 @@
my $letme = Jifty::LetMe->new();
$letme->email($self->to->email);
- $letme->path('confirm_email');
+ $letme->path('set_password');
my $confirm_url = $letme->as_url;
my $appname = Jifty->config->framework('ApplicationName');
- $self->subject( "Welcome to ".$project->name."!" );
+ $self->subject( "Welcome to " . $project->name . "!" );
$self->from( Jifty->config->framework('AdminEmail') );
-
-
+ my $confirm_message = '';
+ if ( $self->to->email_confirmed =~ /^(?:false|0|)$/) {
+ $confirm_message
+ = _("In order to get going, you need to set a password.") . " "
+ . _( "You can do that at: %1", $confirm_url );
+ }
$self->body(<<"END_BODY");
Hi!
We'd like you to join us as a $access_level for @{[$project->name]}.
-The project uses Subversion to manage its codebase. To check code, in
-or out of subversion point your client at:
+The project uses Subversion to manage its codebase. To check code, in or out of subversion point your client at:
@{[$project->svn_url_auth]}
-Your subversion username is: @{[$user->email]}
-Your password is @{[$user->__value('password')]}
+Your username is: @{[$user->email]}
-We know that sending your password in plaintext email is insecure
-and we're actively working to improve matters.
+@{[$confirm_message]}
For more details about @{[$project->name]}, please visit:
Added: commitbit/trunk/share/web/templates/let/set_password
==============================================================================
--- (empty file)
+++ commitbit/trunk/share/web/templates/let/set_password Tue Sep 19 06:09:20 2006
@@ -0,0 +1,26 @@
+<%init>
+Jifty->web->new_action(
+ moniker => 'confirm_email',
+ class => 'ConfirmEmail',
+)->run;
+my $action = Jifty->web->new_action(
+ class => 'UpdateUser',
+ moniker => 'prefsbox',
+ record => Jifty->web->current_user->user_object
+);
+
+my $next = Jifty::Continuation->new(
+ request => Jifty::Request->new( path => "/" ) );
+
+</%init>
+<&|/_elements/wrapper, title => 'Preferences' &>
+<p>Please set a password and nickname.
+ (For now, you can't touch your email address)</p>
+<% Jifty->web->form->start(call => $next, name => "prefbox") %>
+<% $action->form_field('email', render_mode => 'read') %>
+<% $action->form_field('nickname') %>
+<% $action->form_field('password') %>
+<% $action->form_field('password_confirm') %>
+<% Jifty->web->form->submit(label => 'Save', submit => $action) %>
+<% Jifty->web->form->end %>
+</&>
More information about the Rt-commit
mailing list