Skip to content

Instantly share code, notes, and snippets.

@jysperm
Last active January 7, 2016 02:57
Show Gist options
  • Save jysperm/6710267 to your computer and use it in GitHub Desktop.
Save jysperm/6710267 to your computer and use it in GitHub Desktop.
public function signup()
{
if(!$this->isPost())
return $this->render("signup");
try {
list($uname, $passwd, $email, $contact) = $this->post([
"uname" => '/^[A-Za-z][A-Za-z0-9_]+$/',
"passwd",
"email" => '/^[A-Za-z0-9_\-\.\+]+@[A-Za-z0-9_\-\.]+$/',
"contact"
]);
if($this->model->byUName($uname)->data())
throw new lpHandlerException("userExists");
if(in_array($uname, lpPlugin::hook("pUserCenter.notAllowSignup", [])))
throw new lpHandlerException("notAllowSignup");
$this->model->register($uname, $passwd, $email, $contact);
lpApp::goUrl("/");
}
catch(lpHandlerException $e)
{
return $this->render("signup", [
"error" => $e->getMessage()
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment