Better register?

master
Manager Bot 3 years ago
parent 4aa5b353cb
commit 2c485ef89b
  1. 1
      Web/lib/MJB/Web.pm
  2. 15
      Web/lib/MJB/Web/Controller/Auth.pm
  3. 7
      Web/lib/MJB/Web/Controller/UserSettings.pm

@ -178,6 +178,7 @@ sub startup ($self) {
$r->post ( '/register/invite' )->to( 'Auth#do_register_invite' )->name('do_register_invite' );
$r->get ( '/register/stripe' )->to( 'Auth#register_stripe' )->name('show_register_stripe' );
$r->post ( '/register/stripe' )->to( 'Auth#do_register_stripe' )->name('do_register_stripe' );
$r->get ( '/register/stripe/pay' )->to( 'Auth#register_stripe_pay' )->name('show_register_stripe_pay' );
$r->get ( '/login' )->to( 'Auth#login' )->name('show_login' );
$r->post ( '/login' )->to( 'Auth#do_login' )->name('do_login' );
$auth->get( '/logout' )->to( 'Auth#do_logout' )->name('do_logout' );

@ -272,6 +272,21 @@ sub do_register_stripe ( $c ) {
# Log the user in and send them to the dashboard.
$c->session->{uid} = $person->id;
$c->redirect_to( $c->url_for( 'show_register_stripe_pay' ) );
}
#==
# GET /register/stripe/pay | show_register_stripe_pay | N/A
#
# Once a user has registered in the strip work flow, they will need to pay
# for their account before it is enabled. This route will bring them to the
# stripe subscription payment page.
#==
sub register_stripe_pay ( $c ) {
# Don't allow this user registration method unless register.enable_open is true.
return $c->redirect_to( $c->url_for( 'show_register' ) )
unless $c->config->{register}{enable_stripe};
$c->redirect_to(
$c->ua->get( $c->config->{stripe}->{backend} . '/stripe/get-checkout-link?lookup_key=' . $c->config->{stripe}->{lookup_key} )->result->json->{url}
);

@ -134,14 +134,13 @@ sub subscription ($c) {
$c->db->storage->schema->txn_do( sub {
$c->stash->{person}->stripe_customer_id( $customer_id );
$c->stash->{person}->is_subscribed( 1 );
$c->stash->{person}->is_enabled( 1 );
$c->stash->{person}->update;
});
}
$c->stash(
success => 1,
success_message => 'Thank you for signing up!',
);
$c->flash( confirmation => "Thank you for signing up!" );
$c->redirect_to( $c->url_for( 'show_dashboard' ) );
}
# Send to stripe to signup for the subscription

Loading…
Cancel
Save