aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Auth/Phone.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-10-10 14:54:04 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-10-12 12:49:50 +0100
commit8a3072bfdc11121da5a11932c248ab13f6f0d315 (patch)
treef68127e72901d5af130a58b352bf98e4311f084f /perllib/FixMyStreet/App/Controller/Auth/Phone.pm
parent00bc27f2e9abcc6d5c6be71ef5a58cb32f1a028b (diff)
Factor the three SMS code checking fns together.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Auth/Phone.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Auth/Phone.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Auth/Phone.pm b/perllib/FixMyStreet/App/Controller/Auth/Phone.pm
index 6c6d7006e..8387b9d64 100644
--- a/perllib/FixMyStreet/App/Controller/Auth/Phone.pm
+++ b/perllib/FixMyStreet/App/Controller/Auth/Phone.pm
@@ -23,17 +23,19 @@ Handle the submission of a code sent by text to a mobile number.
=cut
sub code : Path('') {
- my ( $self, $c ) = @_;
+ my ( $self, $c, $scope, $success_action ) = @_;
$c->stash->{template} = 'auth/smsform.html';
+ $scope ||= 'phone_sign_in';
+ $success_action ||= '/auth/process_login';
my $token = $c->stash->{token} = $c->get_param('token');
my $code = $c->get_param('code') || '';
- my $data = $c->forward('/auth/get_token', [ $token, 'phone_sign_in' ]) || return;
+ my $data = $c->stash->{token_data} = $c->forward('/auth/get_token', [ $token, $scope ]) || return;
$c->stash->{incorrect_code} = 1, return if $data->{code} ne $code;
- $c->detach( '/auth/process_login', [ $data, 'phone' ] );
+ $c->detach( $success_action, [ $data, 'phone' ] );
}
=head2 sign_in