Файл: view/login/v_login_index.php
Строк: 391
<script type="text/javascript">
var vklogin = false;
function try_to_login(obj, text) {
if (text.substr(0, 4) == 'good') {
var to = '';
if (location.hash.toString().length) {
to += location.hash;
}
if (to.length) {
window.location.href = '/' + to;
} else {
window.location.href = '/id' + text.substr(4);
}
} else if (text.substr(0, 10) == 'not_active') {
window.location.href = '/login.php?r=1';
} else if (text.substr(0, 6) == 'invite') {
window.location.href = '/help.php?page=welcome&hash=' + text.substr(6);
} else if (text.substr(0, 9) == 'reginvite') {
window.location.href = '/register.php?hash=' + text.substr(9);
} else if (text.substr(0, 7) == 'vklogin') {
vklogin = true;
ge('login').submit();
} else {
show('message_text');
ge('message_text').innerHTML = "<div id='error' style='font-size: 11px'>Указан неверный логин или пароль.</div>";
}
}
function quick_login() {
var options = {onSuccess: try_to_login};
hide('message_text');
Ajax.postWithCaptcha('/login.php', {'op': 'a_login_attempt', 'login': ge('email').value}, options);
}
var captcha_send = 'Отправить';
var captcha_cancel = 'Отмена';
function showFastRestoreRows(el) {
while (el.tagName != 'TR') el = domPN(el);
hide(el);
for (var i = 0; i < 5; ++i) {
toggle(el = domNS(el), (i != 2));
}
focusAtEnd('fast_restore_phone');
}
function showPhoneTT() {
hideCodeTT(true);
hidePhoneTT(true);
animate(ge('fast_phone_tt'), window.is_rtl ? {opacity: 1, marginRight: 172} : {opacity: 1, marginLeft: 172}, 200);
}
function hideTT(el, fast) {
if (fast === true) {
var anim = data(el, 'tween');
if (anim) anim.stop();
setStyle(el, window.is_rtl ? {opacity: 0, marginRight: 182} : {opacity: 0, marginLeft: 182});
} else {
animate(el, {opacity: 0}, 200, hidePhoneTT.pbind(true));
}
}
function hidePhoneTT(fast) {
hideTT(ge('fast_phone_tt'), fast);
}
function showCodeTT() {
hideCodeTT(true);
hidePhoneTT(true);
animate(ge('fast_code_tt'), window.is_rtl ? {opacity: 1, marginRight: 172} : {opacity: 1, marginLeft: 172}, 200);
}
function hideCodeTT(fast) {
hideTT(ge('fast_code_tt'), fast);
}
var sentPhone = false, restoreCode = false;
function fastRestoreCheck() {
if (sentPhone !== false) {
if (ge('fast_restore_phone').value == sentPhone) {
show(ge('fast_restore_code_row'));
} else {
hide(ge('fast_restore_code_row'));
}
}
}
function fastRestore(ev) {
ev = ev || window.event;
if (ev && (ev.keyCode !== undefined) && (ev.type != 'click')) {
if (ev.keyCode !== KEY.ENTER) {
return;
}
if (ev.target == ge('fast_restore_phone') && isVisible(ge('fast_restore_code_row'))) {
focusAtEnd(ge('fast_restore_code'));
return cancelEvent(ev);
}
}
var btn = ge('fast_restore_btn'), phone = ge('fast_restore_phone').value, code;
if (phone.replace(/[^0-9]/g, '').length < 8) {
focusAtEnd(ge('fast_restore_phone'));
notaBene(ge('fast_restore_phone'));
return cancelEvent(ev);
}
lockButton(btn);
if (isVisible(ge('fast_restore_code_row'))) {
code = ge('fast_restore_code').value;
if (code.replace(/[^0-9a-z]/g, '').length < 4) {
focusAtEnd(ge('fast_restore_code'));
notaBene(ge('fast_restore_code'));
return cancelEvent(ev);
}
Ajax.postWithCaptcha('login.php', {act: 'fast_restore_code', phone: phone, code: code, restore: restoreCode}, {
onSuccess: function(obj, text) {
var res = eval('(' + text + ')');
unlockButton(btn);
var err = ge('fast_restore_error');
if (res.error) {
err.innerHTML = res.error;
if (!isVisible(err)) {
show(err);
} else {
animate(err, {backgroundColor: '#F4EBBD'}, 100, animate.pbind(err, {backgroundColor: '#F9F6E7'}, 2000));
}
notaBene(ge('fast_restore_code'));
} else if (res.success) {
location.href = 'https://login.vk.com/?act=fast_restored&code=' + restoreCode + '&_origin=' + encodeURIComponent(location.protocol + '//' + location.host);
}
},
onCaptchaShow: function() {
unlockButton(btn);
}
});
} else {
Ajax.postWithCaptcha('login.php', {act: 'fast_restore', phone: phone, hash: '5b661300f253c69b79'}, {
onSuccess: function(obj, text) {
var res = eval('(' + text + ')');
if (res.reload) {
location.reload(true);
return;
}
if (res.wait) {
setTimeout(fastRestore.pbind(false), 1000);
return;
}
unlockButton(btn);
var err = ge('fast_restore_error');
if (res.error) {
err.innerHTML = res.error;
if (!isVisible(err)) {
show(err);
} else {
animate(err, {backgroundColor: '#F4EBBD'}, 100, animate.pbind(err, {backgroundColor: '#F9F6E7'}, 2000));
}
notaBene(ge('fast_restore_phone'));
} else {
restoreCode = res.restore;
hide(err);
sentPhone = phone;
show(ge('fast_restore_code_row'));
setTimeout(focusAtEnd.pbind(ge('fast_restore_code')), 0);
}
},
onCaptchaShow: function() {
unlockButton(btn);
}
});
}
return cancelEvent(ev);
}
</script>
<div id="message_text">
<?=$msg?>
</div>
<div class="simplePage" style="padding: 15px 0px 0px">
<form method="post" name="login" id="login" action="https://login.vk.com/" onsubmit="if (vklogin) { return true} else { quick_login();return false;}">
<input type="hidden" name="act" id="act" value="login">
<input type="hidden" name="to" id="to" value="">
<input type="hidden" name="_origin" value="http://vk.com">
<input type="hidden" name="ip_h" value="320d9b3597d3ebf481">
<table align="center" cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody><tr>
<td class="ta_r log_label"><span class="grey">Телефон или e-mail</span></td>
<td style="padding: 0px">
<input class="inputText" type="text" name="email" value="sdffsd" id="email" style="width: 152px; margin: 0px">
</td><td>
</td></tr>
<tr>
<td class="ta_r log_label"><span class="grey">Пароль</span></td>
<td style="padding: 0px">
<input class="inputText" type="password" name="pass" value="" id="pass" style="width: 152px; margin: 0px">
</td>
</tr>
<tr>
<td class="ta_r log_label"> </td>
<td>
<div id="container1" class="checkbox_container" style="width: 150px;"><table cellpadding="0" cellspacing="0"><tbody><tr><td class="checkbox"><div class="checkbox_off"></div></td><td class="checkbox_label">Чужой компьютер<input type="hidden" name="expire" id="expire" value=""></td></tr></tbody></table></div>
<script type="text/javascript">
function setSelRange(id, from, to) {
var el = ge(id);
if (!el || (el.type.toLowerCase() != 'text' && el.type.toLowerCase() != 'password' && el.tagName.toLowerCase() != 'textarea')) return;
el.focus();
if (el.createTextRange) {
var range = el.createTextRange();
range.collapse(true);
range.moveEnd('character', from);
range.moveStart('character', to);
range.select();
} else if (el.setSelectionRange) {
el.setSelectionRange(from, to);
}
}
function focusAtEnd(id) {
var el = ge(id);
if (!el || (el.type != 'text' && el.type != 'password' && el.tagName.toLowerCase() != 'textarea')) return;
setSelRange(el, el.value.length, el.value.length);
}
onDomReady(function() {
new Checkbox(ge('expire'), {
width: 150,
label: 'Чужой компьютер'
})
focusAtEnd(ge('email').value ? ge('pass') : ge('email'));
if (ge('fast_restore_btn')) {
ge('fast_restore_btn').parentNode.appendChild(ce('div', {innerHTML: '<iframe name="fast_restore_test_frame"></iframe><form id="fast_restore_test_form" method="POST" action="https://login.vk.com/?act=create_test&_origin=http://vk.com&' + Math.random() + '" target="fast_restore_test_frame"></form>'}, {position: 'absolute', visibility: 'hidden'}));
ge('fast_restore_test_form').submit();
}
});
</script>
</td>
</tr>
<tr>
<td class="ta_r log_label"> </td>
<td><div style="height:20px; margin:5px 0px">
<div class="button_blue"><button onclick="quick_login();return cancelEvent(event);">Войти</button></div><span class="divide"> </span><div class="button_blue"><a href="/join" class="button_link"><button onclick="location.href='/join';return cancelEvent(event);">Регистрация</button></a></div>
</div></td>
</tr>
</tbody></table>
<input type="submit" value="." style="color:#fff;border:0;padding:0;margin:0;background:#fff;height:6px;width:6px">
</form>
<div class="login_restore">
<div class="login_msg" id="fast_restore_error" style="display: none"></div>
<table align="center" cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody><tr><td class="ta_r log_label"> </td><td><a onclick="showFastRestoreRows(this)">Забыли пароль или не можете войти?</a></td></tr><tr style="display: none">
<td class="ta_r log_label"> </td>
<td>
<div id="fast_restore_h">Быстрое восстановление пароля</div>
</td>
</tr>
<tr style="display: none">
<td class="ta_r log_label"><span class="grey">Телефон:</span></td>
<td>
<div style="padding: 0px 0px 0px">
<input type="text" class="inputText" onfocus="showPhoneTT()" onblur="hidePhoneTT()" id="fast_restore_phone" value="+7" style="width: 152px" onkeypress="return fastRestore(event)" onkeydown="setTimeout(fastRestoreCheck, 0)">
</div>
<div class="fast_tt" id="fast_phone_tt"><table cellspacing="0" cellpadding="0">
<tbody><tr><td><table cellspacing="0" cellpadding="0">
<tbody><tr><td class="fast_tt_wrap"><div class="fast_tt_text"><div class="fast_tt_pointer"></div>
Номер телефона, к которому привязана Ваша страница.<br><br>Пример номера: <b>+7 906 2233300</b>
</div></td></tr>
<tr><td><div class="fast_tt_bottom_sh1"></div></td></tr>
</tbody></table></td></tr>
<tr><td><div class="fast_tt_bottom_sh2"></div></td></tr>
</tbody></table></div>
</td>
</tr>
<tr id="fast_restore_code_row" style="display: none">
<td class="ta_r log_label"><span class="grey">Полученный код:</span></td>
<td>
<div style="padding: 0px 0px 0px">
<input type="text" class="inputText" onfocus="showCodeTT()" onblur="hideCodeTT()" id="fast_restore_code" onkeypress="return fastRestore(event)" style="width: 152px">
</div>
<div class="fast_tt" id="fast_code_tt"><table cellspacing="0" cellpadding="0">
<tbody><tr><td><table cellspacing="0" cellpadding="0">
<tbody><tr><td class="fast_tt_wrap"><div class="fast_tt_text"><div class="fast_tt_pointer"></div>
На Ваш телефон в течение нескольких секунд придет код.<br><br>Пример кода: <b>p6frke</b>
</div></td></tr>
<tr><td><div class="fast_tt_bottom_sh1"></div></td></tr>
</tbody></table></td></tr>
<tr><td><div class="fast_tt_bottom_sh2"></div></td></tr>
</tbody></table></div>
</td>
</tr>
<tr style="display: none">
<td class="ta_r log_label"> </td>
<td>
<div style="height:20px; margin: 10px 0px; width: 160px;">
<div class="button_blue button_wide"><button id="fast_restore_btn" onclick="return fastRestore()">Восстановить доступ</button><div style="position: absolute; visibility: hidden;"><iframe name="fast_restore_test_frame"></iframe><form id="fast_restore_test_form" method="POST" action="https://login.vk.com/?act=create_test&_origin=http://vk.com&0.3386359722353518" target="fast_restore_test_frame"></form></div></div>
</div>
</td>
</tr>
<tr style="display: none">
<td class="ta_r log_label"> </td>
<td><a href="/restore?email=sdffsd">Я не привязывал страницу к телефону</a></td>
</tr>
</tbody></table>
</div>
</div>