PageSourceSearch

https://eventos.metared.org/js/widgets/login_panel.js

js metared.org collected 2026-09-26 03:30:51 UTC 11,352 bytes, 26 lines download raw bytes

1var popupAuth=false;var processedLogin=false;SYM=window.SYM||{};SYM.LOGIN=SYM.LOGIN||(function(){const DOM={MODAL_CLASS:'.msgbox',LOGIN_IFRAME_VIEW_SELECTOR:'.login-iframe-panel',SIGN_IN:{FORM:{selector:'#form_signin',fields:{username:'#username',password:'#password',redirect:'#redirect_to'}}}};const METHODS={private:{onRecoverPasswordClick:function(ev,customError){ev.preventDefault();ev.stopPropagation();const targetSelector=this.rel;const $targetTemplate=$(targetSelector);$targetTemplate.replaceWith("<script type='symposium-template' id="+targetSelector.replace('#','')+">"+$targetTemplate.html()+"</script>");var $overlay=$(targetSelector);if($overlay.length){$overlay.find('div.warning').remove();$msgbox=msgbox($overlay.html(),'activator fixed-center');const $form=$msgbox.find('form');const $form_id=$form.attr('id')+'_'+Math.random(0,99999)+(new Date()).getTime();$form.attr('id',$form_id);var possibleEmail=$('#username').val();if(possibleEmail!==''){$input=$msgbox.find('#username_recoverpw');if($input.length){$input.val(possibleEmail);}}
2if(customError){var $customErrorMessage=$('<div class="warning"></div>').html(customError);$msgbox.find('form').before($customErrorMessage);}
3METHODS.private.initRecoverPasswordYav($form);}
4return false;},initRecoverPasswordYav:function($form_param){const $form=$form_param||$('#form_recoverpw');$form.yav({errorMessage:msg.DATA_NOT_VALID,errorPosition:'after',errorDiv:'errorDiv_recoverpw',onOk:function(the_form){$('.error',the_form).remove();$.post(noCache(the_form.action),$form.serialize(),function(response){var data=evalJson(response);if(data.stat==='ERROR'){$form.find('#errorDiv_recoverpw').append($('<p></p>').addClass('error').text(_msg(data.msg,data.msg)));}else{the_form.reset();msgbox_close();msgbox_alert(_msg(data.msg,data.msg),true,()=>{},'alert-view',{expose:{color:'#000',loadSpeed:0,opacity:0.5}});}});return false;},onError:function(){return false;}});},loadLoginTemplate:async function(){return await $.get('/login/get_login_widget_template');},getLoginActions:function(){return $('.login-action, a[href="/login.html"], a[href="/login"]');},getLoginTemplate:async function(){$template=$('#modal-login-panel-template');if(!$template.length){$response=await METHODS.private.loadLoginTemplate();$('body').append($response);$template=$("#modal-login-panel-template");return $template.html();}else{return $template.html();}},resizeIframe:function($iframe){return new Promise(function(resolve,reject){let doc=null;try{doc=$iframe[0].contentDocument?$iframe[0].contentDocument:$iframe[0].contentWindow.document;}catch(e){}
5if(!doc)return resolve();const body=doc.body;const html=doc.documentElement;const $iframeHolder=$iframe.parent();const height=Math.max(body.scrollHeight,body.offsetHeight,html.clientHeight,html.scrollHeight,html.offsetHeight);let computed=getComputedStyle($iframeHolder[0]);let holderPadding=parseInt(computed.paddingTop)+parseInt(computed.paddingBottom);let holderHeight=$iframeHolder[0].clientHeight-holderPadding;let finalHeight=height;let windowHeight=parseInt(window.innerHeight)*0.9-holderPadding;if(windowHeight<height){finalHeight=windowHeight*0.9;}
6$iframe[0].style.visibility='hidden';$iframe[0].style.height="10px";$iframe[0].style.height=finalHeight+"px";$iframe[0].style.visibility='visible';resolve();});},goCrypt:function(){$.getJSON(noCache('/login/getpublickey'),{},function(response){if(!response){msgbox_alert(_msg('SERVER_ERROR'));return;}
7if(typeof response.pubkey=='undefined'||!response.pubkey){msgbox_alert(_msg('SERVER_ERROR'));return;}
8var pubKey=forge.pki.publicKeyFromPem(response.pubkey);var url=$(DOM.SIGN_IN.FORM.selector).attr('action');var userName=base64_encode(pubKey.encrypt(forge.util.encodeUtf8($(DOM.SIGN_IN.FORM.fields.username).val())));var userPassword=base64_encode(pubKey.encrypt(forge.util.encodeUtf8($(DOM.SIGN_IN.FORM.fields.password).val())));var redirection=$(DOM.SIGN_IN.FORM.fields.redirect).val();if(SYM.LOGIN.emagister){url=$('#emagister_form_signin').attr('action');loginString=$('#emagister_username').val()+'|'+$('#emagister_password').val();}
9var params={userName:userName,userPassword:userPassword,'redirection':redirection};const $captcha=$(".g-recaptcha-response",$(DOM.SIGN_IN.FORM.selector));if($captcha.length){params["recaptcha_response"]=$captcha.val();}
10$.post(url,params,METHODS.public.onLoginResponse,'json');});}},public:{onLoginResponse:function(data){processedLogin=true;if(typeof(data)==='function'){const $redirectTo=$(DOM.SIGN_IN.FORM.fields.redirect);$redirectTo[0].redirect=data;$redirectTo[0].urlredirect=$redirectTo.attr('value');$redirectTo.attr('value','#');}else{if(data.stat==='ERROR'){if(typeof(data.type)!=='undefined'){if(data.type==='RSA_KEY'){$('#errorDiv'+(SYM.LOGIN.emagister?'2':'1')).append($('<p></p>').addClass('error').html(msg.RSA_KEY_ERROR));document.location.href=document.location.href;}}
11if(data.type!==null&&data.type==='direct_render'){var error_string=data.msg;}
11else if(data.msg=='NEW_USER_PASSWORD_REQUIRED'){var title=$('<h2></h2>').addClass('modal_title').html(_msg('NEW_USER_PASSWORD_REQUIRED'));var description=$('<p></p>').addClass('modal_description').html(_msg('NEW_USER_PASSWORD_REQUIRED_DESCRIPTION').replace('{EMAIL}',$('#username').val()));var html=$('<div></div>').append(title).append(description);msgbox_alert(html.html(),true,function(){},'alert-view');return false;}else{var error_string=_msg(data.msg,data.msg);}
12if(SYM.LOGIN.emagister){$('.tip-twitter').remove();var error_tooltip=$('#emagister_username','#emagister_form_signin').poshytip({content:error_string,className:'tip-twitter',showTimeout:1,alignTo:'target',alignX:'right',alignY:'center',showOn:'focus',allowTipHover:false,fade:false,slide:false}).poshytip('show');}else{$('#errorDiv1').append($('<p></p>').addClass('error').html(error_string));}
13const $captcha=$(".g-recaptcha-response",$(DOM.SIGN_IN.FORM.selector));if($captcha.length){grecaptcha.reset();}}else if(data.stat==='2FA'){if(!data.redirect_to){const msg=data?.msg||'SERVER_ERROR';const $modal=msgbox_alert(_msg(msg,msg));$modal.find('.msgbox_alert_button').on('click',function(){document.location.href=document.location.href;});return;}
14const doc=(parent&&parent.window&&parent.window.document)?parent.window.document:document;doc.location.href=data.redirect_to;return;}else{let r_url=$('#redirect_to').val();if(typeof(data.ajaxurl)!=='undefined'){$('#loginResponse').attr('src',_SERVERURI+data.ajaxurl);}else if(r_url!=='#'){const doc=(parent&&parent.window&&parent.window.document)?parent.window.document:document;if(data.eventattend){doc.location.href=r_url;}else{if(typeof(data.redirect_to)==='undefined'||data.redirect_to===''){r_url=r_url.replace(/@/gi,'/');if(r_url.indexOf('http')===0){doc.location.href=r_url;return;}
15if(r_url.indexOf('/')===0){r_url=r_url.substr(1);}
16doc.location.href=_SERVERURI+r_url;}else{doc.location.href=data.redirect_to;}}}else{$("#redirect_to")[0].redirect(data);$("#redirect_to").val($("#redirect_to")[0].urlredirect);}}}},onLoginRedirect:function(data){onLoginResponse($.extend(data,{eventattend:false}));},tryLoginModal:function(){let $loginAction=METHODS.private.getLoginActions();if($loginAction.length){$loginAction.click(function(ev){ev.preventDefault();ev.stopPropagation();METHODS.private.getLoginTemplate().then(function(template){if(template&&template!==""){const loginModal=msgbox(template,"activator fixed-center");loginModal.css('width','480px');if(loginModal.find('iframe').length){loginModal[0].style.visibility='hidden';const loginModalIframe=loginModal.find('iframe');loginModalIframe.css({width:'100%',border:'0px'});loginModalIframe.on('load',function(){METHODS.private.resizeIframe(loginModalIframe).then(function(){loginModal[0].style.visibility="visible";});$(window).on("resize",function(){METHODS.private.resizeIframe(loginModalIframe);});$('body').on('login-iframe-content-scroll',function(ev){METHODS.private.resizeIframe(loginModalIframe);});});}else{SYM.LOGIN.init();}}});return false;});}else{$("body").one("render.handlebars",function(e,template){if(_ENVIRONMENT=="testing")console.log("rendered "+template);METHODS.public.tryLoginModal();});}},init:function(){const inIframe=window!==window.top;if($('#sir_login').length&&!$('#um_login').length&&!$('#signup_form').length){$('.wi_background').addClass('wide');$('#login_signin').addClass('right');}
17$('#login_panel_trigger').click(function(){$('#login_signin').fadeToggle('slow');});
17$('#form_signin h4').click(function(){var e=$(this).next();$('#form_signin h4').next().not(e).slideUp();e.slideDown();$('span',$('#form_signin h4').not(this)).html('+');$('span',this).html('-');});const $formSignIn=$(DOM.SIGN_IN.FORM.selector);if($formSignIn.length){$formSignIn.yav({errorMessage:msg.DATA_NOT_VALID,errorPosition:'after',errorDiv:'errorDiv1',onOk:function(){$('#errorDiv1').removeClass('error').empty();SYM.LOGIN.emagister=false;METHODS.private.goCrypt();return false;},onError:function(){var error_string='';$.each($('p.error',$formSignIn),function(i,el){error_string+='<li>- '+$(this).html()+'</li>';if(i===0){error_string=error_string.replace('<li>- ','<li class="title">');}
18$(this).remove();});$('#errorDiv1').addClass('error').empty().append($('<ul></ul>').addClass('error').html(error_string));return false;}});}
19if($('#emagister_form_signin').length>0){$('#emagister_form_signin').yav({errorMessage:msg.DATA_NOT_VALID,errorDiv:'errorDiv2',errorPosition:'after',onOk:function(){$('#errorDiv2').removeClass('error').empty();SYM.LOGIN.emagister=true;METHODS.private.goCrypt();return false;},onError:function(){if($('input.c:first','#emagister_form_signin').attr('id')==='emagister_password'){$('#emagister_password').show();$('.fake_label','#emagister_form_signin').hide();}else{$('#emagister_password').hide();$('.fake_label','#emagister_form_signin').show();}
20$('.tip-twitter').remove();var error_tooltip=$('input.c:first','#emagister_form_signin').poshytip({content:$('p.error').eq(1).text(),className:'tip-twitter',showTimeout:1,alignTo:'target',alignX:'right',alignY:'center',showOn:'focus',allowTipHover:false,fade:false,slide:false}).poshytip('show');$('#errorDiv2').removeClass('error').empty();return false;}});}
21if($('#providers_list').length>0){$('#providers_list button').click(function(){window.open('/login/rpx/'+$(this).attr('rel'));return false;});$("#providers_list a").click(function(){window.open("/login/rpx/"+$(this).attr("rel"));return false;});}
22$('#recoverpw-trigger').click(METHODS.private.onRecoverPasswordClick);$('#send-confirmation').live("click",function(){$.post(noCache("/registration/send_confirmation_email/"),{usrid:this.name},function(response){var data='';try{data=evalJson(response);}catch(e){data={stat:'ERROR',msg:'error'};}
23if(data.stat==='OK'){msgbox_info(data.msg);}});return false;});const $loginSirLink=$('a[href="/login/sir"]');if($loginSirLink.length){$loginSirLink.on('click',function(ev){if(inIframe){ev.preventDefault();ev.stopPropagation();window.top.location=$loginSirLink.attr('href');return false;}});}
24if(inIframe){$(window).scroll(function(ev){window.top.$('body').trigger('login-iframe-content-scroll');});}}}}
25return METHODS.public;}());SYM.LOGIN.emagister=false;$.fn.ready(function(){SYM.LOGIN.init();});function onLoginResponse(data){SYM.LOGIN.onLoginResponse(data);}
26function onLoginRedirect(data){SYM.LOGIN.onLoginRedirect(data);}

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.