[Rt-commit] r5939 - in commitbit: . lib/CommitBit/Notification
jesse at bestpractical.com
jesse at bestpractical.com
Fri Sep 15 11:07:59 EDT 2006
Author: jesse
Date: Fri Sep 15 11:07:58 2006
New Revision: 5939
Added:
commitbit/lib/CommitBit/Notification/InviteToProject.pm (contents, props changed)
Modified:
commitbit/ (props changed)
commitbit/lib/CommitBit/Model/ProjectMember.pm
commitbit/lib/CommitBit/Model/User.pm
Log:
r27504 at pinglin: jesse | 2006-09-15 16:07:50 +0100
* invitations basically work
Modified: commitbit/lib/CommitBit/Model/ProjectMember.pm
==============================================================================
--- commitbit/lib/CommitBit/Model/ProjectMember.pm (original)
+++ commitbit/lib/CommitBit/Model/ProjectMember.pm Fri Sep 15 11:07:58 2006
@@ -7,7 +7,7 @@
use CommitBit::Model::User;
use CommitBit::Model::Project;
-
+use CommitBit::Notification::InviteToProject;
use CommitBit::Record schema {
column user =>
@@ -30,8 +30,12 @@
$args{'user'} = $self->_email_to_id($args{'user'});
- return $self->SUPER::create(%args);
+ my (@result) = $self->SUPER::create(%args);
+ if ($self->id) {
+ my $invite = CommitBit::Notification::InviteToProject->new( project => $self->project, to => $self->user, sender =>$self->current_user->user_object, role => $self->role)->send;
+ }
+ return (@result);
}
Modified: commitbit/lib/CommitBit/Model/User.pm
==============================================================================
--- commitbit/lib/CommitBit/Model/User.pm (original)
+++ commitbit/lib/CommitBit/Model/User.pm Fri Sep 15 11:07:58 2006
@@ -39,6 +39,12 @@
}
+sub auth_token {
+ my $self = shift;
+ return Digest::MD5::md5_hex($self->id . $self->__value('password'));
+
+}
+
=head2 current_user_can
=cut
@@ -48,7 +54,8 @@
my $right = shift;
my %args = (@_);
if ($right eq 'read') {
- if ($args{'column'} eq 'password') {
+
+ if ($args{'column'} && $args{'column'} eq 'password') {
return 0;
}
return 1;
Added: commitbit/lib/CommitBit/Notification/InviteToProject.pm
==============================================================================
--- (empty file)
+++ commitbit/lib/CommitBit/Notification/InviteToProject.pm Fri Sep 15 11:07:58 2006
@@ -0,0 +1,74 @@
+use warnings;
+use strict;
+
+package CommitBit::Notification::InviteToProject;
+use base qw/CommitBit::Notification/;
+
+
+__PACKAGE__->mk_accessors(qw/project sender role/);
+
+=head1 NAME
+
+CommitBit::InviteToProject
+
+=head1 ARGUMENTS
+
+C<to>, a L<Jifty::Plugin::Login::Model::User> whose address we are confirming.
+
+=cut
+
+=head2 setup
+
+Sets up the fields of the message.
+
+=cut
+
+sub setup {
+ my $self = shift;
+
+ my $project = $self->project;
+ my $role = $self->role;
+ my $user = $self->to;
+
+ my $letme = Jifty::LetMe->new();
+ $letme->email($self->to->email);
+ $letme->path('confirm_email');
+ my $confirm_url = $letme->as_url;
+ my $appname = Jifty->config->framework('ApplicationName');
+
+ $self->subject( "Welcome to ".$project->name."!" );
+ $self->from( Jifty->config->framework('AdminEmail') );
+
+
+
+ $self->body(<<"END_BODY");
+
+Hi!
+
+We'd like you to join us as a $role for @{[$project->name]}.
+
+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')]}
+
+We know that sending your password in plaintext email is insecure
+and we're actively working to improve matters.
+
+For more details about @{[$project->name]}, please visit:
+
+@{[Jifty->config->framework('Web')->{'BaseURL'}]}/project/@{[$project->name]}
+
+
+Before you can use $appname, we need to make sure that we got your email
+address right. Click on the link below to get started:
+
+$confirm_url
+
+END_BODY
+}
+
+1;
More information about the Rt-commit
mailing list