PageSourceSearch

https://gordonbrothersmarketplace.com/Scripts/Account/SignIn/SignIn.js

js gordonbrothersmarketplace.com collected 2026-10-09 22:13:04 UTC 3,918 bytes, 113 lines download raw bytes

1var signinConfig = $('#signin-config');
2var signinNotification;
3var signinDefaultErrorMessage = signinConfig.attr('data-default-error-message') || '';
4
5var loginModel = mvvmLite.observable({
6  response: {},
7  accountLockedErrorMessage: "",
8  showBack: getParameterByName('returnUrl').length > 0,
9  backUrl: getParameterByName('returnUrl'),
10  signInUser: function (e) {
11    var $form = $('#signin_form');
12
13    if ($form.valid()) {
14      startBlock('signin_form');
15      $.ajax({
16        url: $form.attr('action'),
17        type: 'POST',
18        data: $form.serialize(),
19        success: function (data) {
20          if (data.success) {
21            let redirectUrl = $('#hdnReturnUrl').val();
22            let redirectToReturnUrl = redirectUrl && redirectUrl.indexOf('/account/verify') < 0;
23            if (redirectToReturnUrl) {
24              window.location.href = redirectUrl;
25            }
26            else {
27              window.location.href = signinConfig.attr('data-home-url');
28            }
29          }
30          else {
31            var msg = data.errorMessage
32              ? { success: false, error: true, errorMessage: data.errorMessage, data: data.data }
33              : data;
34
35            loginModel.set("accountLockedErrorMessage", msg.data && msg.data.accountLocked ? msg.errorMessage || "" : "");
36            loginModel.set("response", msg);
37            endBlock('signin_form');
38          }
39        },
40        error: function (e) {
41          var err = { success: false, error: true, errorMessage: resolveAjaxErrorMessage(e, signinDefaultErrorMessage), data: {} };
42          loginModel.set("accountLockedErrorMessage", "");
43          loginModel.set("response", err);
44          endBlock('signin_form');
45        }
46      });
47    }
48
49    return false;
50  },
51  resendWelcomeEmail: function (e) {
52    if (!$('#signin_form').valid()) {
53      return false;
54    }
55    startBlock('signin_form');
56    $.ajax({
57      url: signinConfig.attr('data-resend-email-confirmation-url'),
58      data: $('#signin_form').serialize(),
59      type: 'POST',
60      success: function (e) {
61        if (e.success) {
62          signinNotification.show("Verification email has been re sent!", "success");
63          var err = { success: true };
64          loginModel.set("accountLockedErrorMessage", "");
65          loginModel.set("response", err);
66        }
67        else {
68          var err = { success: false, error: true, errorMessage: e.errorMessage };
69          loginModel.set("accountLockedErrorMessage", "");
70          loginModel.set("response", err);
71        }
72        endBlock('signin_form');
73      },
74        error: function (e) {
75          var err = { success: false, error: true, errorMessage: resolveAjaxErrorMessage(e, signinDefaultErrorMessage), data: {} };
76        loginModel.set("accountLockedErrorMessage", "");
77        loginModel.set('response', err);
78        endBlock('signin_form');
79      }
80    });
81    return false;
82  }
83});
84
85mvvmLite.bind(document.getElementById("div_signinForm"), loginModel);
86
87$(document).ready(function () {
88  $('#hdnOffset').val(new Date().getTimezoneOffset());
89
90  signinNotification = GBComponents.mountNotification(document.getElementById("clipboardNotification"), {
91    autoHideAfter: 5000,
92    dismissible: true,
93    position: {
94      top: 30,
95      right: 30
96    }
97  });
98
99  if (signinConfig.attr('data-email-verified') === 'true') {
100    var msg = "Your Email has been successfully verified.";
101    signinNotification.show(msg, "success");
102  }
103
104  if (signinConfig.attr('data-email-verification-error') === 'true') {
105    var msg = "Email verification failed. Please try again or request a new verification link.";
106    signinNotification.show(msg, "error");
107  }
108
109  var prefillEmail = signinConfig.attr('data-prefill-email');
110  if (prefillEmail) {
111    $('#Email').val(prefillEmail);
112  }
113});

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.