public function action_help() { if ($_POST) { $user = ORM::factory('User')->where('email', '=', $_POST['email'])->find(); if ($user->loaded()) { $token = ORM::factory('User_Token'); $token->user_id = $user->id; $token->created = time(); $token->expires = strtotime('+2 hours'); //$token -> type = 'password'; $token->save(); $mail = mail::create('userforgotpass')->to($user->email)->tokenize(array('username' => $user->username, 'resetlink' => user::url('password/' . $token->token, 'http')))->send(); notes::info('Check your e-mail! We\'ve sent you a mail with instructions on resetting your password.'); user::redirect('login'); } else { $url = user::url('signup'); notes::add('error', 'No account is registerred with that e-mail address'); } } }