Sistema di login / logout / registrazione
Modifiche allo stile
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 16/mar/2016
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__)."/load.php");
|
||||
|
||||
try {
|
||||
$sent = false;
|
||||
$msg = "";
|
||||
$action = PostHandler::get("action");
|
||||
$email = "";
|
||||
|
||||
if (!is_null($action) && strcmp($action, "recover")==0){
|
||||
$email = trim(PostHandler::get("email"));
|
||||
|
||||
$user = GlobalVariables::get("dao")->getFirst("UserModel",array("email"=>$email)); // WTF!?!?!
|
||||
|
||||
if (is_null($user)){
|
||||
$msg = "Email non valida";
|
||||
}
|
||||
else {
|
||||
$sent = true;
|
||||
$mail = FDN_MailHelper::getUserPasswordResetMail($user);
|
||||
// GlobalVariables::get("dao")->save($mail);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}catch(GUIException $ex){
|
||||
$msg = $ex->getMessage();
|
||||
$err = true;
|
||||
}catch (Exception $exec){
|
||||
$msg = LogModel::fromException($exec);
|
||||
GlobalVariables::get("dao")->save($msg);
|
||||
}
|
||||
|
||||
if ($sent){
|
||||
?>
|
||||
<div style="padding:2em;">A breve riceverai una email per modificare la password!</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
?>
|
||||
<a class="close" href="javascript:void(0);" onClick="$('#floating').hide();">x</a>
|
||||
<div class="modalBody">
|
||||
<div class="title">Inserisci la tua email per recuperare i dati</div>
|
||||
<div style="color:red; text-align:center;"><?php echo $msg;?></div>
|
||||
<form id="recForm">
|
||||
<input type="hidden" name="action" value=""/>
|
||||
<div><input placeholder="EMAIL" type="text" name="email" value="<?php echo $email; ?>"/></div>
|
||||
<div class="btn"><a class="btn" id="recoverBtn" href="javascript:void(0);">RICHIEDI</a></div>
|
||||
</form>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$("#recoverBtn").click(function () {
|
||||
$("#recForm input[name=action]").val("recover");
|
||||
$.ajax({
|
||||
method:"POST",
|
||||
url:'passwordForgot.php',
|
||||
data:$("#recForm").serialize(),
|
||||
success: function(data){
|
||||
$("#floating").html(data);
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#recForm input[name=email]').keypress(function(event) {
|
||||
if (event.which==13){
|
||||
$("#recoverBtn").click();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user