Commit 22e56139 authored by Lucas Saliés Brum's avatar Lucas Saliés Brum 🖐🏻

Autocommit por GitLab.sh: alterações: add 'index.php' add 'js/script.js'

parent 3aea5b30
<?php
// Catch cURL/Wget requests
//if (isset($_POST['envio']) && !empty($_POST['envio']) || isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/^(curl|wget)/i', $_SERVER['HTTP_USER_AGENT'])) {
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) &&
strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ||
isset($_SERVER['HTTP_USER_AGENT']) &&
preg_match('/^(curl|wget)/i', $_SERVER['HTTP_USER_AGENT'])) {
$tamanho = ( isset($_POST['tamanho']) ) ? (int)$_POST['tamanho'] : 10;
$maiusculas = ( isset($_POST['maiusculas']) ) ? $_POST['maiusculas'] : true;
$minusculas = ( isset($_POST['minusculas']) ) ? $_POST['minusculas'] : true;
......@@ -32,7 +36,7 @@ if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQU
$senha = utf8_decode($senha);
echo substr(str_shuffle($senha),0,$tamanho);
exit(0);
exit();
}
?>
<!DOCTYPE html>
......
$(function() {
$("#numeros").prop("checked", false);
if(localStorage.getItem('senha')) {
$("#senha").val(localStorage.getItem('senha'));
}
if(localStorage.getItem('tamanho')) {
$('select#tamanho>option:eq(' + num +')').attr('selected', true);
}
if(localStorage.getItem('minusculas')) {
$("#minusculas").prop("checked", localStorage.getItem('minusculas') )
}
if(localStorage.getItem('maiusculas')) {
$("#maiusculas").prop("checked", localStorage.getItem('maiusculas') )
}
if(localStorage.getItem('numeros')) {
$("#numeros").prop("checked", localStorage.getItem('numeros') )
}
if(localStorage.getItem('simbolos')) {
$("#simbolos").prop( "checked", localStorage.getItem('simbolos') )
}
var clipboard = new ClipboardJS('.copiar');
function recupera() {
......@@ -7,7 +33,7 @@ $(function() {
url: $("#formulario").attr('action'),
type: 'post',
data: $("#formulario").serialize(),
//dataType: 'text',
dataType: 'text'
success: function(data) {
$("#senha").val(data);
localStorage.setItem('senha', data);
......@@ -27,4 +53,25 @@ $(function() {
}
recupera();
});
$('#tamanho').change(function() {
localStorage.setItem('tamanho', $(this).val());
});
$('#minusculas').change(function() {
localStorage.setItem('minusculas', $(this).is(':checked'));
});
$('#maiusculas').change(function() {
localStorage.setItem('maiusculas', $(this).is(':checked'));
});
$('#numeros').change(function() {
localStorage.setItem('numeros', $(this).is(':checked'));
});
$('#simbolos').change(function() {
localStorage.setItem('simbolos', $(this).is(':checked'));
});
});
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment