function user_block_auth(form) {
	$.getJSON(
		'./ajax/user/auth',
		$(form).serialize(),
		function(d) {
			if (d.user_id) {
				if (d.recovery) {
					$("#login_form").hide();
					$.jqDialog.confirm(
						"Вы ввели новый пароль, сгенерированный нашей системой. Хотите его изменить?",
						function() {window.location='/users/change_pass.html';},
						function() {
							if (location.search) {
								location.replace(location.pathname);
							}
							else {
								location.reload();
							}
						}
					);
				}
				else {
					if (location.search) {
						location.replace(location.pathname);
					}
					else {
						location.reload();
					}
				}
			}
			if (d.errors) {
				var er = new Array();
				for (key in d.errors) {
					er.push(d.errors[key])
				}
				alert(er.join("\n").replace(/<\/?[^>]+>/gi, ''));
			}
		}
	);
	return false;
}

