From 210af8f7fe28c2bf522f78e95ad4b4bcf5e17dae Mon Sep 17 00:00:00 2001 From: Michael Francis Date: Sun, 10 Jul 2011 00:37:13 -0400 Subject: Moved to signup --- controllers/UsersController.php | 84 ----------------------------------------- 1 file changed, 84 deletions(-) diff --git a/controllers/UsersController.php b/controllers/UsersController.php index e6e0675..57d7efe 100644 --- a/controllers/UsersController.php +++ b/controllers/UsersController.php @@ -222,42 +222,6 @@ class UsersController extends \lithium\action\Controller { } } - - - public function signup() - { - $user = null; - //If the request isn't empty - if($this->request->data) - { - //Create a user from the data - $user = User::Create($this->request->data); - - //The user isn't active until after they confirm. - $user->confirmed = false; - $user->active = false; - $user->joinedOn = new MongoDate(); - - //By default save does validation at the same time, - //If there are errors its stuffs them into the $user->_erorrs variable, - //Accessible from $user->errors(), this is automatically passed to the view. - if ($user->save()) - { - //Generate a confirmation key for the user - $key = confirmKey::Create(array('key' => confirmKey::generate($user->email), 'username' => $user->username)); - - //Save it to the database - $key->save(); - - //For testing, we return the link to the view, so they can click it, - //This will be replaced with an email in production - $link = "/users/confirm"; - return compact('key', 'link', 'user'); - } - } - return compact('user'); - } - /* If the user is valid, but not confirmed, tell the user they haven't confirmed, @@ -430,54 +394,6 @@ class UsersController extends \lithium\action\Controller { } - public function confirm($key = null) - { - //Situation one - //They have a key - if (!(empty($key))) - { - //Find the key in the database - $foundKey = confirmKey::find('first', array('conditions' => compact('key'))); - - //If the key exists - if($foundKey != NULL) - { - /* Note: foundKey->validates() does the same check, but it was added incase more validation is needed */ - //Find that user in the database - $foundUser = User::find('first', array('conditions' => array("username" => $foundKey->username))); - $valid = ($foundUser != NULL); - - //Set the users account active and confirmed. - $foundUser->confirmed = true; - $foundUser->active = true; - - //If the user is saved sucsessfully, - if($foundUser->save(null, array('validate' => false))) - { - /* If the save is sucsessful we are done */ - //Delete their key, - $foundKey->delete(); - - //Send them to the homepage (probably login though) - $this->redirect("/"); - - } - else - { - FlashMessage::set("There was an error."); - } - - } - else - { - //Otherwise - FlashMessage::set("There was an error finding the key."); - return; - } - } - } - - public function step2() { //Check that step1 is completed sucsessfully, -- cgit v1.2.3