synergia-jira-connector
Version:
Easy to use NodeJS wrapper for the Jira REST API.
38 lines (34 loc) • 1.18 kB
JavaScript
module.exports = PasswordClient;
/**
* Used to access Jira REST endpoints in '/rest/api/2/password'
*
* @param {JiraClient} jiraClient
* @constructor PasswordClient
*/
function PasswordClient (jiraClient) {
this.jiraClient = jiraClient;
/**
* Returns user-friendly statements governing the system's password policy.
*
* @method getPasswordPolicy
* @memberOf PasswordClient#
* @param opts The request options to send to the Jira API
* @param {boolean} [opts.hasOldPassword=false] Whether or not the user will be required to enter their current
* password. Use false (the default) if this is a new user or if an administrator is forcibly changing another
* user's password.
* @param callback Called when the password policy has been retrieved.
*/
this.getPasswordPolicy = function (opts, callback) {
var options = {
uri: this.jiraClient.buildURL('/password/policy'),
method: 'GET',
json: true,
followAllRedirects: true,
qs: {
hasOldPassword: opts.hasOldPassword
}
};
this.jiraClient.makeRequest(options, callback);
}
}
;