summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2008-11-15 06:23:09 +0000
committerBharat Mediratta <bharat@menalto.com>2008-11-15 06:23:09 +0000
commitae7839ffaada72c522ffcd9b3f4f1cc04027a720 (patch)
tree50ce67306eace68cd23c294fc1aa40ba32c03bcc /core
parent26c8772e16b0328358d23ee4c29f9b592e632b28 (diff)
Revise the user login code.
* Remove user registration link and popup from the theme; this shouldn't be done in a popup. Use ajaxform to simplify the way that we load the login popup. * Create form.html.php, this is a template for Forge based forms. * Move user validation rules into User_Model and let forms populate the rules into their forms as useful. * Undo r18688's changes regarding the REST code. We should never accept a null resource, this breaks the REST abstraction. * Change login and user controllers to use Forge which lets us delete login.html.php and user.html.php since those now are generated by the theme-owned form template
Diffstat (limited to 'core')
-rw-r--r--core/controllers/item.php4
-rw-r--r--core/controllers/rest.php17
2 files changed, 4 insertions, 17 deletions
diff --git a/core/controllers/item.php b/core/controllers/item.php
index 286eb66f..78ee7b0b 100644
--- a/core/controllers/item.php
+++ b/core/controllers/item.php
@@ -21,10 +21,6 @@ class Item_Controller extends REST_Controller {
protected $resource_type = "item";
public function _get($item) {
- if (empty($item)) {
- // A null item is not allowed for albums or photos.
- return Kohana::show_404();
- }
// Redirect to the more specific resource type, since it will render
// differently. We could also just delegate here, but it feels more appropriate
// to have a single canonical resource mapping.
diff --git a/core/controllers/rest.php b/core/controllers/rest.php
index 6e0acbcb..09c85653 100644
--- a/core/controllers/rest.php
+++ b/core/controllers/rest.php
@@ -49,23 +49,14 @@
abstract class REST_Controller extends Controller {
protected $resource_type = null;
- public function dispatch($id=null) {
+ public function dispatch($id) {
if ($this->resource_type == null) {
throw new Exception("@todo ERROR_MISSING_RESOURCE_TYPE");
}
- if ($id != null) {
- // @todo this needs security checks
- $resource = ORM::factory($this->resource_type, $id);
- if (!$resource->loaded) {
- return Kohana::show_404();
- }
- } else if (request::method() == "get") {
- // A null id and a request method of "get" just returns an empty form
- // @todo figure out how to handle the input without and id
- // @todo do we use put for create and post for update?
- $resource = null;
- } else {
+ // @todo this needs security checks
+ $resource = ORM::factory($this->resource_type, $id);
+ if (!$resource->loaded) {
return Kohana::show_404();
}
/**