PageSourceSearch

https://identity.embo.org/js/oauth2/Authorize.js?version=1.49.2

js embo.org collected 2026-09-24 08:40:38 UTC 2,200 bytes, 59 lines download raw bytes

1/*
2 * Copyright (c) 2018-2023, FusionAuth, All Rights Reserved
3 */
4'use strict';
5
6var FusionAuth = FusionAuth || {};
7FusionAuth.OAuth2 = FusionAuth.OAuth2 || {};
8
9/**
10 * @constructor
11 */
12FusionAuth.OAuth2.Authorize = function() {
13  Prime.Utils.bindAll(this);
14
15  this.form = Prime.Document.queryFirst('form[action*="authorize"]');
16  this.deviceName = this.form.queryFirst('input[name="metaData.device.name"]');
17  this.deviceType = this.form.queryFirst('input[name="metaData.device.type"]');
18  this.timezone = this.form.queryFirst('input[name="timezone"]');
19  this.uvpaAvailableField = this.form.queryFirst('input[name="userVerifyingPlatformAuthenticatorAvailable"]');
20
21  var os = Prime.Browser.os;
22  if (os === 'Mac') {
23    os = 'macOS';
24  }
25
26  this.deviceName.setValue(os + ' ' + Prime.Browser.name);
27  this.deviceType.setValue('BROWSER');
28  var guessed = jstz.determine();
29  this.timezoneAvailable = Prime.Utils.isDefined(guessed.name());
30  if (this.timezoneAvailable) {
31    this.timezone.setValue(guessed.name());
32    document.cookie = 'fusionauth.timezone=' + guessed.name() + '; path=/';
33  }
34  if (this.uvpaAvailableField !== null
35      && typeof(PublicKeyCredential) !== 'undefined'
36      && PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable) {
37    PublicKeyCredential
38      .isUserVerifyingPlatformAuthenticatorAvailable()
39      .then(result => this.uvpaAvailableField.setValue(result));
40  }
41
42  // There are other links on the page with device name, type and timezone
43  Prime.Document.query('a').each(this._updateURLs);
44};
45
46FusionAuth.OAuth2.Authorize.constructor = FusionAuth.OAuth2.Authorize;
47FusionAuth.OAuth2.Authorize.prototype = {
48  _updateURLs: function(element) {
49    var href = element.getAttribute('href');
50    if (href !== null) {
51      href = href.replace(/(metaData\.device\.name=)[^"&]*/, '$1' + encodeURIComponent(this.deviceName.getValue()));
52      href = href.replace(/(metaData\.device\.type=)[^"&]*/, '$1' + encodeURIComponent(this.deviceType.getValue()));
53      if (this.timezoneAvailable) {
54        href = href.replace(/(timezone=)[^"&]*/, '$1' + encodeURIComponent(this.timezone.getValue()));
55      }
56      element.setAttribute('href', href);
57    }
58  }
59};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.