Name

global.PwdAjaxVerifyIdentityDESKTOP

Description

Verify the user information provided on the first page of password reset experience.

Script

var PwdAjaxVerifyIdentityDESKTOP = Class.create();

PwdAjaxVerifyIdentityDESKTOP.prototype = Object.extendsObject(PwdAjaxVerifyIdentity, {
  /*
   * OVERRIDE verifyIdentity function:
   * Swap the implamentation PwdVerifyIdentity with PwdVerifyIdentityDESKTOP, to allow bypassing google reCaptcha for the Desktop App.
   * This will impact the functionality of the verification method in the parent class.
   */
  WINDOWS_SOURCE_FIELD: '2',
  verifyIdentity: function() {
      var response = PwdAjaxVerifyIdentity.prototype.verifyIdentity.call(this);

      //Update Password reset source field to windows 
      var requestId = gs.getSession().getProperty('sysparm_request_id');
      var grResetRequest = new GlideRecord('pwd_reset_request');
      if (grResetRequest.get(requestId)) {
          grResetRequest.source = this.WINDOWS_SOURCE_FIELD;
          grResetRequest.update();
      }

      // Update the desktop access-log record, with the corresponding request ID:
      var gr = new GlideRecord('pwd_access_log');
      if (gr.get(gs.getSession().getProperty('sysparm_pwd_access_log_id'))) {
          gr.request = requestId;
          gr.update();
      }

      // For web app we return code instead of string as response regarding security concerns
      // But for Windows app we still use string response
      return this._stringifyResponse(response);
  },

  _stringifyResponse: function(response) {
      if (response == "200")
          return "ok";
      else if (response == "500")
          return "invalid user";
      else
          return response;
  },

  type: 'PwdAjaxVerifyIdentityDESKTOP'
});

Sys ID

d8b0f843531222004acce17de2dc34e2

Offical Documentation

Official Docs: