FreeSTAR-Status-Engine/admin/lost-password.php

72 lines
3.0 KiB
PHP
Raw Normal View History

2017-11-23 18:09:36 -05:00
<?php
Template::render_header(_("Lost password"));
2017-11-23 18:09:36 -05:00
?>
<div class="text-center">
2017-12-30 18:41:58 -05:00
<h1><?php echo _("Lost password");?></h1>
2017-11-23 18:09:36 -05:00
</div>
<div id="login-form" class="center">
<?php
if (isset($_POST['id']))
{
$user = new User($_POST['id']);
$user->change_password($_POST['token']);
if (isset($message)){?>
<p class="alert alert-danger"><?php echo $message?></p>
2018-03-09 18:07:40 -05:00
<a href="<?php echo WEB_URL;?>/admin/?do=lost-password<?php echo "&id=".$_POST['id']."&token=".$_POST['token'];?>"><?php echo _("Go back");?> </a>
2017-11-23 18:09:36 -05:00
<?php
}
else{?>
2017-12-30 18:41:58 -05:00
<p class="alert alert-success"><?php echo _("Password changed successfully!");?></p>
<a href="<?php echo WEB_URL;?>/admin/"><?php echo _("Go back to login page");?></a>
2017-11-23 18:09:36 -05:00
<?php
}
}
else if (isset($_POST['email']))
{
User::password_link();
if (isset($message)){?>
<p class="alert alert-danger"><?php echo $message?></p>
<a href="<?php echo WEB_URL;?>/admin/?do=lost-password"><?php echo _("Go back to start");?></a>
2017-11-23 18:09:36 -05:00
<?php
}
else{?>
2017-12-30 18:41:58 -05:00
<p class="alert alert-success"><?php echo _("Email with password reset link has been sent!");?></p>
<a href="<?php echo WEB_URL;?>/admin/"><?php echo _("Go back to login page");?></a>
2017-11-23 18:09:36 -05:00
<?php
}
}
else{
if (isset($message)){?>
<p class="alert alert-danger"><?php echo $message?></p>
<?php }?>
<form action="<?php echo WEB_URL;?>/admin/?do=lost-password" method="post">
2017-11-23 18:09:36 -05:00
<?php if (!isset($_GET['id'])||!isset($_GET['token'])){?>
2017-12-30 18:41:58 -05:00
<label for="email"><?php echo _("Email");?>:</label>
2017-11-23 18:09:36 -05:00
<div class="input-group pull-right">
2018-01-18 16:59:34 -05:00
<input class="form-control" name="email" id="email" placeholder="<?php echo _("Email");?>" type="email" required>
2017-11-23 18:09:36 -05:00
<span class="input-group-btn">
2017-12-30 18:41:58 -05:00
<button type="submit" class="btn btn-success pull-right"><?php echo _("Submit request");?></button>
2017-11-23 18:09:36 -05:00
</span>
</div>
<?php }
else{
$user = new User($_GET['id']);
?>
2017-12-30 18:41:58 -05:00
<p class="alert alert-info"><?php printf(_("Reset password for %s (%s)"),$user->get_name(), $user->get_username());?></p>
2017-11-23 18:09:36 -05:00
<input type="hidden" name="id" value="<?php echo $_GET['id'];?>" >
<input type="hidden" name="token" value="<?php echo $_GET['token'];?>" >
2017-12-30 18:41:58 -05:00
<label for="new_password"><?php echo _("New password");?></label>
<input id="new_password" placeholder="<?php echo _("New password");?>" type="password" class="form-control" name="password">
<label for="new_password_check"><?php echo _("Repeat password");?></label>
<input id="new_password_check" placeholder="<?php echo _("Repeat password");?>" type="password" class="form-control" name="password_repeat">
<button type="submit" class="btn btn-primary pull-right margin-top"><?php echo _("Change password");?></button>
2017-11-23 18:09:36 -05:00
<?php
}
?>
</form>
<?php }?>
</div>
<?php
Template::render_footer();