aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm26
1 files changed, 26 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index d0a5a3a4f..97cb28fe8 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -182,6 +182,8 @@ use Utils;
use FixMyStreet::Map::FMS;
use LWP::Simple qw($ua);
use RABX;
+use URI;
+use URI::QueryParam;
my $IM = eval {
require Image::Magick;
@@ -511,6 +513,30 @@ sub admin_url {
return $cobrand->admin_base_url . '/report_edit/' . $self->id;
}
+=head2 tokenised_url
+
+Return a url for this problem report that logs a user in
+
+=cut
+
+sub tokenised_url {
+ my ($self, $user, $params) = @_;
+
+ my $token = FixMyStreet::App->model('DB::Token')->create(
+ {
+ scope => 'email_sign_in',
+ data => {
+ id => $self->id,
+ email => $user->email,
+ r => $self->url,
+ p => $params,
+ }
+ }
+ );
+
+ return "/M/". $token->token;
+}
+
=head2 is_open
Returns 1 if the problem is in a open state otherwise 0.