diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-09-27 14:46:46 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-09-30 15:04:06 +0100 |
commit | c7d98f98bf4faa1a60552dd11195eb134445b6b3 (patch) | |
tree | 47028cce45ce2ac77c5208f18bdb02b45d7220c2 /perllib/FixMyStreet/DB/Result/Problem.pm | |
parent | d0ae2a420905dbd0b79141d88e2c47956d1d65b2 (diff) |
Adapt things that assume email will be present.
This includes stopping some emails being sent (moderation, alert,
questionnaire), dealing with Open311/email report sending, and
tokenised_url.
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Problem.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index b954a68ab..56601480d 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -485,12 +485,21 @@ Return a url for this problem report that logs a user in sub tokenised_url { my ($self, $user, $params) = @_; + my %params; + if ($user->email_verified) { + $params{email} = $user->email; + } elsif ($user->phone_verified) { + $params{phone} = $user->phone; + # This is so the email token can look up/ log in a phone user + $params{login_type} = 'phone'; + } + my $token = FixMyStreet::App->model('DB::Token')->create( { scope => 'email_sign_in', data => { + %params, id => $self->id, - email => $user->email, r => $self->url, p => $params, } |