summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService/User.pm
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2013-09-13 03:57:13 +0200
committerDave Lawrence <dlawrence@mozilla.com>2013-09-13 03:57:13 +0200
commit745fdb4bd5b582db6266ea20cb0597208820548b (patch)
tree9deb4f69106760aa3157ccf8cfa2957d265cab3d /Bugzilla/WebService/User.pm
parentce2dca7ce56ff9806fa72d781c21e47fa750ef98 (diff)
downloadbugzilla-745fdb4bd5b582db6266ea20cb0597208820548b.tar.gz
bugzilla-745fdb4bd5b582db6266ea20cb0597208820548b.tar.xz
Bug 909442 - backport upstream bug 908338 to bmo/4.2 to add User.valid_login webservice method
Diffstat (limited to 'Bugzilla/WebService/User.pm')
-rw-r--r--Bugzilla/WebService/User.pm55
1 files changed, 55 insertions, 0 deletions
diff --git a/Bugzilla/WebService/User.pm b/Bugzilla/WebService/User.pm
index 32e11a2a4..7aa1a626b 100644
--- a/Bugzilla/WebService/User.pm
+++ b/Bugzilla/WebService/User.pm
@@ -94,6 +94,17 @@ sub logout {
Bugzilla->logout;
}
+sub valid_login {
+ my ($self, $params) = @_;
+ defined $params->{login}
+ || ThrowCodeError('param_required', { param => 'login' });
+ Bugzilla->login();
+ if (Bugzilla->user->id && Bugzilla->user->login eq $params->{login}) {
+ return $self->type('boolean', 1);
+ }
+ return $self->type('boolean', 0);
+}
+
#################
# User Creation #
#################
@@ -424,6 +435,50 @@ Log out the user. Does nothing if there is no user logged in.
=back
+=head2 valid_login
+
+B<UNSTABLE>
+
+=over
+
+=item B<Description>
+
+This method will verify whether a client's cookies or current login
+token is still valid or have expired. A valid username must be provided
+as well that matches.
+
+=item B<Params>
+
+=over
+
+=item C<login>
+
+The login name that matches the provided cookies or token.
+
+=item C<token>
+
+(string) Persistent login token current being used for authentication (optional).
+Cookies passed by client will be used before the token if both provided.
+
+=back
+
+=item B<Returns>
+
+Returns true/false depending on if the current cookies or token are valid
+for the provided username.
+
+=item B<Errors> (none)
+
+=item B<History>
+
+=over
+
+=item Added in Bugzilla B<5.0>.
+
+=back
+
+=back
+
=head1 Account Creation
=head2 offer_account_by_email