I have 2 problems to solve. I have this little function first
if(!$verified) {
$this->db->trans_rollback();
$this->form_validation->set_message('token_expired', 'Token expired try again.');
$this->load->view('header');
$this->load->view('forgot_password_view');
$this->load->view('footer');
}
I just pasted the code that was needed, so when the verification failed, I want to load the given message in the passpassword file, but the problem is that I use this page for verification errors with other things, and I also want this message showed this function does not work. Here is an idea.
<div class="well">
<?php echo validation_errors(); ?>
<?php
if(validation_errors() != false)
{
echo '<div class="form-group alert alert-danger has-error">';
echo'<ul>';
echo validation_errors('<li class="control-label">', '</li>');
echo'</ul>';
echo '</div>';
}
?>
<?php echo form_open('login/reset_password'); ?>
<h1>Forgot your password?</h1>
<p>Please enter your email address so we will send you a link to change your password</p>
<div class="<?php if(form_error('email')!= null){echo ' has-error';} ?>">
<input name="email" style="width: 20%" class="form-control" type="email" placeholder="Enter your email Address"/>
<button style="margin-top:20px;" class="btn btn-default" type="submit" name="submit">Submit</button>
</div>
</div>
I thought the first echo validation_errors might take care of token_expired, but of course it doesnβt work, and the second check is done when I check if the email check passes.
My second problem is that I have a function that works, but pasting the current time + 15 minutes. I am in helsinki / Finland, so I use it like this.
function __construct(){
parent::__construct();
date_default_timezone_set('Europe/Helsinki');
......
$data = array(
'expiration' => date("Y-m-d h:i:s", strtotime("+15 minutes")),
);
, 12 , 1pm 13:15:00, 01:15:00 .