diff --git a/application/models/Users.php b/application/models/Users.php new file mode 100644 index 0000000..faeb8d5 --- /dev/null +++ b/application/models/Users.php @@ -0,0 +1,42 @@ +getAdapter(), $this->_name, 'email', 'password'); + + // Set credentials + $authAdapter->setIdentity($email); + $authAdapter->setCredential($password); + + // Authenticate + $result = $auth->authenticate($authAdapter); + + // Check result + if ($result->isValid()) { + // Keep all but password and salt in session. + $storage = $auth->getStorage(); + $storage->write($authAdapter->getResultRowObject(null, array('password', 'salt'))); + + return true; + } + + return false; + } +} \ No newline at end of file diff --git a/application/modules/default/views/scripts/auth/login.phtml b/application/modules/default/views/scripts/auth/login.phtml new file mode 100644 index 0000000..5a9691c --- /dev/null +++ b/application/modules/default/views/scripts/auth/login.phtml @@ -0,0 +1,6 @@ +

translate('u:login') ?>

+ +

translate('LOGIN_TXT') ?>

+ +form ?> + diff --git a/application/modules/default/views/scripts/auth/logout.phtml b/application/modules/default/views/scripts/auth/logout.phtml new file mode 100644 index 0000000..e69de29 diff --git a/library/Fiktiv/Controller/Action.php b/library/Fiktiv/Controller/Action.php new file mode 100644 index 0000000..0ca0e90 --- /dev/null +++ b/library/Fiktiv/Controller/Action.php @@ -0,0 +1,14 @@ +view, 'translate'), $args); + } +} \ No newline at end of file diff --git a/library/Fiktiv/View/Helper/AuthLink.php b/library/Fiktiv/View/Helper/AuthLink.php new file mode 100644 index 0000000..c1a8fa0 --- /dev/null +++ b/library/Fiktiv/View/Helper/AuthLink.php @@ -0,0 +1,18 @@ + 'default', 'controller' => 'auth'); + + if ($auth->hasIdentity()) { + return '' . $this->view->translate('u:logout') . ''; + } + + return '' . $this->view->translate('u:login') . ''; + } + +} \ No newline at end of file diff --git a/library/Fiktiv/View/Helper/Url.php b/library/Fiktiv/View/Helper/Url.php new file mode 100644 index 0000000..38ccd0c --- /dev/null +++ b/library/Fiktiv/View/Helper/Url.php @@ -0,0 +1,6 @@ +url('controller', 'action', array()) if third is not array, assume "id" e.g. blog/post/id + */ \ No newline at end of file