Guest User

Untitled

a guest
Jun 21st, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. sub create_user {
  2. my ($self, $options) = @_;
  3.  
  4. $options ||= {};
  5. my $config = BoyosPlace->config;
  6. my $email = BoyosPlace::Email->new(
  7. to => $options->{email},
  8. from => $config->{email}{from},
  9. subject => "Boyosplace.com Registration Confirmation",
  10. data => "Thank you for signing up!",
  11. );
  12.  
  13. my $create = sub {
  14. my $user = $self->create(
  15. {
  16. name => $options->{name},
  17. email => $options->{email},
  18. password => $options->{password},
  19. }
  20. );
  21. $user->add_to_user_roles({ roleid => 1 });
  22. my $rv = $email->send;
  23. die $rv unless $rv;
  24. };
  25.  
  26. $self->txn_do($create);
  27.  
  28. if ($@) {
  29. die "Something went wrong creating a user: $@";
  30. exit;
  31. }
  32.  
  33.  
  34. }
Add Comment
Please, Sign In to add comment