PageSourceSearch

https://static.gotprint.com/tl/account/login/js/login.js?v=0109_20260902_202634-100

js gotprint.com collected 2026-10-02 03:56:31 UTC 8,685 bytes, 269 lines download raw bytes

1login = {};
2login.migrateInfo='';
3login.callstarted = false;
4if(typeof isPopup != 'boolean'){
5	isPopup = false;
6}
7
8jQuery(document).ready(function(){
9	jQuery('#login').off('click').on('click', function(){
10		if(window.isUserLoggedIn){
11    		location.reload();
12    	}else{
13		  if(!login.callstarted) {
14			  login.callstarted = true;
15			  login.util.submit(jQuery("#login-form"));
16		  }
17		}
18	});
19	
20	
21	let toolTipPosition = jQuery(window).width() > 450 ? 'right' : 'top';
22	
23    jQuery('[data-toggle="keepSignedIn-popover"]').popover({
24				  trigger: "hover",
25				  //container:'#login-form',
26				  title: ' ',
27	              html: true,
28	              placement:toolTipPosition,
29	              template: '<div class="keepSignedIn-popover-toolTip popover" role="popover"><div class="arrow"></div><div class="popover-body" style="max-width:35rem;font-size:1.0rem;"></div></div>',
30	              content: function() {}}
31	             );
32	             
33	
34	jQuery('#sample-login').off('click').on('click', function(){
35		login.util.submit(jQuery("#sample-login-form"));
36	});
37	jQuery('#btnSample-login').off('click').on('click', function(){
38		isPopup = false;
39		login.util.submit(jQuery("#sample-login-form"));
40	});
41	
42	jQuery('#loginEmail,#login-password').keyup(function(event){
43		var key = window.event ? window.event.keyCode : event.keyCode;
44		if(key == 13 && !login.callstarted){
45			login.callstarted = true;
46			login.util.submit(jQuery("#login-form"));
47		}
48	});
49	jQuery("#easyTransferSteps").off('click').on('click', function(){
50		jQuery('.transfer-steps').slideToggle(function(){
51			jQuery("#easyTransferSteps i").toggleClass('rotate');
52			if(store == 101 && isLoginPage){
53				jQuery("#wrapper").toggleClass('login-bg-img');
54			}
55		});
56	});
57	
58	jQuery('#login-form input').keyup(function() {
59		inputRequired(jQuery(this));
60	});
61	
62	jQuery("#visitOldWebsite").off('click').on('click', function(){
63		window.location.href='http://gotprint.net/';
64	});
65	
66	jQuery("#migrateNewWebsite").off('click').on('click', function(){
67		login.util.migrateToNewWebsite();
68	});
69	if(typeof Storage != 'undefined'){
70		sessionStorage.removeItem("userInfo");
71	}
72	jQuery('#warning-popup').off('hidden.bs.modal').on('hidden.bs.modal', function (e) {
73		window.location=accountApi.userHome;
74	});
75	
76	if(typeof getUrlParameter == 'function'){
77		var capturedViewStateParam = getUrlParameter('capturedViewState');
78		if(capturedViewStateParam.length > 0){
79			var href = jQuery("#join").attr('href');
80			    href = href+'?capturedViewState='+capturedViewStateParam;
81			    jQuery("#join").attr('href',href);
82			    jQuery("#top-nav .join-link").attr('href',href);
83		}
84	}
85	jQuery('.pog-menu-links li a').off('click').on('click', function(){
86		accountApi.util.showMobileMenu(false,jQuery('#pog-login-menu'),'mob-active');
87	});
88	
89	jQuery('#loginSignupPopup').off('hidden.bs.modal').on('hidden.bs.modal', function () {
90		login.util.cancel();
91	})
92});
93
94login.util = {
95	showErrorMsg:function(formElm,msg){
96		jQuery('#error-msg').remove();
97		var error='<div id="error-msg" class="messages error-message mb-4">\
98			        <span class="info-icon-div red-alert-bg">\
99			        	<span class="info-icon"><i class="fal fa-info-circle error-icon"></i></span>\
100			   		</span>\
101				   <div class="message-text">\
102				     <h6 class="default-font bold">Error</h6>\
103				     <div>'+msg+'</div>\
104				   </div>\
105				 </div>';
106				
107		if(formElm.attr('id') == 'login-form'){
108			jQuery('#login-form h1').after(error);
109		}else{
110			if(window.isUserLoggedIn){
111				jQuery('#inside-content').prepend(error);
112			}else{
113				jQuery('#is-customer-container').after(error);
114			}
115		}
116		clearTimeout(login.timeout);
117		login.timeout = setTimeout(function(){ jQuery('#error-msg').remove(); }, 6000);
118	},
119	migrateToNewWebsite:function(){
120		if(typeof Storage != 'undefined' && login.migrateInfo.length > 0){
121			if(typeof encodeString == 'function'){
122				migrateInfo = encodeString(login.migrateInfo);
123			}
124			sessionStorage.setItem('migrateInfo',migrateInfo);
125		}
126		window.location = '/user/migrate/account/info';
127	},
128	manageSuccess:function(manageOauthToken, data){
129		if(manageOauthToken && data && typeof setAccessToken != 'undefined'){
130			setAccessToken(data);
131		}
132		if(typeof localStorage != 'undefined'){
133			localStorage.loggedInInfo = true;
134			localStorage.removeItem('keepSignedInFlag');
135			if(jQuery('#keepSignedIn').prop('checked') || jQuery('#freeSampelKeepSignedIn').prop('checked')){
136				localStorage.keepSignedInFlag = true;
137			}
138		}
139		jQuery('.login-signup-loader-overlay').hide();
140		
141		if(typeof isFreeSamplePage == 'undefined'){
142			isFreeSamplePage = false;
143		}
144		if(isPopup && !isFreeSamplePage) {
145			var dataLayer = window.dataLayer = window.dataLayer || [];
146			dataLayer.push({
147				'visitorIP': window.envInfo.visitorIP,
148				'event':'logInEvent',
149				'virtualPageURL': '/user/login/overlay'
150			});
151			jQuery('#loginSignupPopup').modal('hide');
152			if(typeof photoAlbumToMediaClip != "undefined" && photoAlbumToMediaClip){
153				isUserLoggedIn = true;
154				launchMediaClip(loginConfig.selectedSize);
155				return;
156			}
157			window.location.reload();
158		}
159		if(isLoginPage && !isFreeSamplePage) {
160			if(data && data.messageList && data.messageList.length > 0){
161				jQuery("#warning-popup .modal-body p").html(data.messageList[0].value);
162				jQuery("#warning-popup").modal({
163				    backdrop: 'static',
164				    keyboard: false
165				});
166			}
167			else{
168				window.location=accountApi.util.getCapturedViewState();
169			}
170		}else{// if sample kit landing page
171			if(typeof freeSamples == 'object'){
172				freeSamples.util.addToCartAfterLogin();
173			}
174		}
175		
176	},
177	manageFail:function(formElm,data,loginInfo){
178		jQuery('.login-signup-loader-overlay').hide();
179		if(data && data.messageList && data.messageList.length> 0){
180			if(data.messageList[0].value == 'User status is not valid'){
181				login.util.showErrorMsg(formElm,invalidLoginAttempt);
182			}
183			else if(data.messageList[0].id == 231){
184				//login.util.showErrorMsg(formElm,data.messageList[0].value);
185				window.location = '/user/password/reset';
186			}
187			else if(isLoginPage && data.messageList[0].code == 'can_migrate'){
188				login.migrateInfo = loginInfo;
189				jQuery("#migrate-popup").modal({
190				    backdrop: 'static',
191				    keyboard: false
192				});
193		}
194			else if(isLoginPage && data.messageList[0].code == 'must_migrate'){
195						login.migrateInfo = loginInfo;
196						login.util.migrateToNewWebsite();
197			}
198			else if(data.messageList[0].code == 'already_logged_in'){
199				login.util.showErrorMsg(formElm,alreadyLoggedIn);
200				if(isLoginPage){
201					window.location=accountApi.util.getCapturedViewState();
202				}else{
203					if(location.href.indexOf('products/sample-kits') >= 0){
204						window.location = '/products/sample-kits/order.html';
205					}else{
206						window.location.reload();
207					}
208				}
209				
210			}
211			else if(data.messageList[0].resource != 'UUID'){
212				login.util.showErrorMsg(formElm,data.messageList[0].value);
213			}
214		}
215	},
216	submit: function(formElm) {// uses same mathod in sample kit landing page as well
217		if(!form.validation(formElm)){
218			login.callstarted = false;
219			return;
220		}
221		var email,password;
222		if(formElm.attr('id') == 'sample-login-form'){
223			email = handleSpecialCharacter(formElm.find('#sample-loginEmail').val());
224			password = formElm.find('#sample-login-password').val();
225		}else{
226			email = handleSpecialCharacter(formElm.find('#loginEmail').val());
227			password = formElm.find('#login-password').val();
228		}
229		var keepSignedInCheckbox = formElm.attr('id') == 'sample-login-form' ? '#freeSampelKeepSignedIn' : '#keepSignedIn';
230		var keepSignedInFlag = jQuery(keepSignedInCheckbox).prop('checked') === true;
231		var loginInfo={
232				username:email,
233				password:password,
234				grant_type:"password",
235				keepMeLoggedIn:keepSignedInFlag,
236		}
237		loginInfo = JSON.stringify(loginInfo);
238		var manageOauthToken = isManageOauthTokenFlag;
239		if(manageOauthToken == undefined || manageOauthToken == null){
240			manageOauthToken=false;
241		}
242
243		jQuery('.login-signup-loader-overlay').show();
244
245		accountApi.util.remotePostCallWithProgress('/service/rest/v1/oauth/token?generateOAuthToken='+manageOauthToken, loginInfo ).done(function(data) {
246			login.callstarted = false;
247			login.util.manageSuccess(manageOauthToken,data);
248			
249		}).fail(function(jqXHR, textStatus, errorThrown){
250			login.callstarted = false;
251			if(jqXHR.status && jqXHR.status == 201){
252				login.util.manageSuccess(manageOauthToken,jqXHR.responseJSON);
253			}
254			login.util.manageFail(formElm,jqXHR.responseJSON,loginInfo);
255			
256		});
257	},
258	
259	cancel: function(){
260		if(typeof photoAlbumToMediaClip != "undefined" && photoAlbumToMediaClip){
261			isUserLoggedIn = true;
262			launchMediaClip(loginConfig.selectedSize);
263			return;
264		}
265	}
266
267	   
268}
269

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.