summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--controllers/UsersController.php48
-rw-r--r--models/User.php9
-rw-r--r--views/layouts/default.html.php6
-rw-r--r--views/users/signup.html.php32
-rw-r--r--webroot/.htaccess5
5 files changed, 32 insertions, 68 deletions
diff --git a/controllers/UsersController.php b/controllers/UsersController.php
index d1b3193..e6e0675 100644
--- a/controllers/UsersController.php
+++ b/controllers/UsersController.php
@@ -226,50 +226,36 @@ 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);
-
- //Until the save bug is fixed
- $results = $user->validates();
-
- if ($results)
- {
- //The user isn't active until after they confirm.
- $user->confirmed = false;
- $user->active = false;
- $user->joinedOn = new MongoDate();
+ //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();
-
- //If everything goes ok
- if ($user->save(null, array('validates' => false)))
- {
- //Store some session information
- //Session::write('username', $user->username);
- //Session::write('email', $user->email);
-
- //For the debug version, send the key to the front page
- $link = "/users/confirm";
- return compact('key', 'link');
-
- // /*
- // //Send them to the confirmation page.
- // $this->redirect('users/confirm');
-
- }
- }
- else
- {
- return compact('user');
+
+ //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');
}
/*
diff --git a/models/User.php b/models/User.php
index 920c6a7..bf9eec2 100644
--- a/models/User.php
+++ b/models/User.php
@@ -76,13 +76,12 @@ class User extends \lithium\data\Model {
'email' => array(array('email', 'message' => 'The email address is not valid.'),
array('notEmpty', 'message' => 'An email address must be entered.'),
array('isUniqueEmail', 'message' => 'That email address is already in use. Did you forget your password?')
- ),
+ ) /*,
-
- //Passwords validation is invented.
- 'password' => array(array('lengthBetween' =>array('min' => '6', 'max' =>'20'),
+
+ 'newpass' => array(array('lengthBetween' => array('min' => '6', 'max' =>'20'),
'message' => 'Your password must be between 6 and 20 characters')
- ) /*,
+ )*/ /*,
//It's always possible for people to submit invalid data using cURL or something.
'gender' => array('isValidGender', 'message' => 'Please check for dangly bits or lack thereof.')
diff --git a/views/layouts/default.html.php b/views/layouts/default.html.php
index 7a32401..a81dbe8 100644
--- a/views/layouts/default.html.php
+++ b/views/layouts/default.html.php
@@ -4,7 +4,7 @@ use \lithium\security\Auth;
<!DOCTYPE html>
<html>
<head>
- <?= $this->html->charset() ?>
+ <?= $this->html->charset(); ?>
<title>OtakuHub<?php $title = $this->title(); if ($title) echo " > $title" ?></title>
<?= $this->html->style(array('style', 'base')) ?>
<?= $this->html->style('themes/light') ?>
@@ -66,14 +66,14 @@ use \lithium\security\Auth;
<br class="cl" />
</header>
<div id="page">
- <?= $this->content() ?>
+ <?php echo $this->content() ?>
</div>
<footer>
<p>Copyright ©2011, <a href="http://www.melenion.org">Melenion Dev Studios</a></p>
<br class="cl" />
</footer>
-<?= $this->html->script("/js/jquery-1.6.1.min.js") ?>
+<?= $this->html->script("/js/jquery-1.6.1.min.js"); ?>
<?= $this->html->script("/js/jquery.anchor.js"); ?>
<?= $this->html->script("/js/jquery.tools.min.js"); ?>
<?= $this->html->script("/js/jquery.form.js"); ?>
diff --git a/views/users/signup.html.php b/views/users/signup.html.php
index 185fcae..5b26977 100644
--- a/views/users/signup.html.php
+++ b/views/users/signup.html.php
@@ -5,37 +5,13 @@ $this->styles($this->html->style("/css/signup.css"));
<?php if (isset($key)): ?>
Confirmation Link: <a href="<?=$link ?>/<?=$key->key ?>"> Link </a>
<?php else: ?>
-<?php if(isset($user)): ?>
+<?=$this->flashMessage->output(); ?>
+
+
<?=$this->form->create($user); ?>
-<?php else: ?>
-<?=$this->form->create(); ?>
-<?php endif; ?>
<?=$this->form->field('username'); ?>
<?=$this->form->field('newpass', array('type' => 'password', 'label' => 'password')); ?>
<?=$this->form->field('email'); ?>
<?=$this->form->submit('Signup!'); ?>
<?=$this->form->end(); ?>
-<?php endif; ?>
-
-<!--
- <div id="signup">
- <h2>Sign up:</h2>
- <form method="post" action="/users/signup">
- <table>
- <tr>
- <td><label for="username">Username</label></td>
- <td><input type="text" name="username" id="username">
- </tr>
- <tr>
- <td><label for="password">Password</label></td>
- <td><input type="password" id="password" name="password"></td>
- </tr>
- <tr>
- <td><label for="email">Email</label></td>
- <td><input type="text" id="email" name="email"></td>
- </tr>
- </table>
- <input class="button green" type="submit" value="Sign up">
- </form>
- </div>
--->
+<?php endif; ?> \ No newline at end of file
diff --git a/webroot/.htaccess b/webroot/.htaccess
index 21796cf..7029a45 100644
--- a/webroot/.htaccess
+++ b/webroot/.htaccess
@@ -4,4 +4,7 @@
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !favicon.ico$
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
-</IfModule> \ No newline at end of file
+</IfModule>
+<IfModule mod_php5.c>
+ php_value short_open_tag 1
+</IfModule>