Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow short names like Max #96

Merged
merged 1 commit into from Nov 13, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 19 additions & 19 deletions application/controllers/action.php
Expand Up @@ -11,7 +11,7 @@
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Action extends CI_Controller{

public function __construct(){
parent::__construct();
$this->load->helper('url');
Expand All @@ -20,7 +20,7 @@ public function __construct(){
}
public function register(){
require_once('public/recaptcha/recaptchalib.php');

$votes = $this->get->getSetting('maxvotes');
$title = $this->get->getSetting('title');
$mainmail = $this->get->getSetting('mainmail');
Expand All @@ -35,13 +35,13 @@ public function register(){
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);

if(!$resp->is_valid){
header('Location: '. base_url() .'home/register/recaptcha');
return;
}
}
if(strlen($name) < 7){
if(strlen($name) < 3){
header('Location: '. base_url() .'home/register/name');
return;
}
Expand All @@ -61,23 +61,23 @@ public function register(){
if($this->post->add_user($name, $email, $pass, $votes, false)){
$message = "Welcome to our feedback: $title\n\nYour Email: $email\nYour Password: $pass\n\n\nPlease login here:" . base_url() . "home/login\n";
$this->load->library('email');

$this->email->initialize($this->get->email_config());

$this->email->from($mainmail, 'PHPBack');
$this->email->to($email);
$this->email->to($email);

$this->email->subject("New account - $title");
$this->email->message($message);
$this->email->message($message);

$this->email->send();

header('Location: '. base_url() .'home/login/register');
}
else header('Location: '. base_url() .'home/register/exists');

}

public function login(){
session_start();

Expand All @@ -99,7 +99,7 @@ public function login(){
header('Location: ' . base_url() . 'home/login/errorlogin/');
}
}

public function logout(){
session_start();
session_destroy();
Expand Down Expand Up @@ -153,28 +153,28 @@ public function changepassword(){
if(strlen($new) > 5){
if($new == $rnew){
$user = $this->get->getUser($_SESSION['phpback_userid']);

if($this->hashing->matches($old, $user->pass)){
$this->post->update_by_id('users', 'pass', $this->hashing->hash($new), $user->id);
$message = "You have changed your password to: $new\n";
$this->load->library('email');
$this->email->initialize($this->get->email_config());

$mainmail = $this->get->getSetting('mainmail');
$title = $this->get->getSetting('title');

$this->email->from($mainmail, 'PHPBack');
$this->email->to($user->email);
$this->email->to($user->email);

$this->email->subject("Password changed - $title");
$this->email->message($message);
$this->email->message($message);

$this->email->send();

header('Location: ' . $toredirect);
}
else $this->redirectpost($toredirect, array('error' => 2));

}
else $this->redirectpost($toredirect, array('error' => 1));
}
Expand Down Expand Up @@ -221,12 +221,12 @@ public function flag($cid, $ideaid, $ideaname){
header("Location: " . base_url(). "home/login");
exit;
}
$this->post->flag($cid, $_SESSION['phpback_userid']);
$this->post->flag($cid, $_SESSION['phpback_userid']);
header("Location: " . base_url() . "home/idea/" . $ideaid . '/' . $ideaname);
}

private function redirectpost($url, array $data){

echo '<html>
<head>
<script type="text/javascript">
Expand Down