Skip to content

Commit

Permalink
Registration, e-mail confirmation, forgotten pass
Browse files Browse the repository at this point in the history
  • Loading branch information
wingman007 committed Jul 17, 2013
1 parent b58f755 commit 8e70ced
Show file tree
Hide file tree
Showing 24 changed files with 841 additions and 3 deletions.
15 changes: 15 additions & 0 deletions AlterTable.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ALTER TABLE users ADD `usr_password_salt` varchar(100) DEFAULT NULL COMMENT 'dynamicSalt',

INSERT INTO `users` VALUES (2,'stoyan','50f2405710d1ea8a0e6a0d6b4471586c','[email protected]',NULL,NULL,1,NULL,NULL,NULL,'eqwe3213');

string to encripting: aFGQ475SDsdfsaf2342passwordeqwe3213

ALTER TABLE users ADD `usr_registration_date` DATETIME DEFAULT NULL COMMENT 'Registration moment';
ALTER TABLE users ADD `usr_registration_token` varchar(100) DEFAULT NULL COMMENT 'unique id sent by e-mail';

ALTER TABLE users ADD `usr_email_cofirmed` tinyint(1) NOT NULL COMMENT 'e-mail confirmed by user';

=========== Error and correction ===============================================
ALTER TABLE users ADD `usr_email_cofirmed` tinyint(1) NOT NULL COMMENT 'e-mail confirmed by user';

ALTER TABLE users CHANGE `usr_email_cofirmed` `usr_email_confirmed` tinyint(1) NOT NULL COMMENT 'e-mail confirmed by user';
29 changes: 29 additions & 0 deletions composer.autoload.coolcsn.json.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "zendframework/skeleton-application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2"
],
"homepage": "http://framework.zend.com/",
"minimum-stability": "alpha",
"repositories": [
{
"type": "composer",
"url": "http://packages.zendframework.com/"
}
],
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "2.*",
"zendframework/zendservice-recaptcha": "2.*",
"doctrine/common": ">=2.1",
"doctrine/doctrine-orm-module": "0.*"
},
"autoload": {
"psr-0": {
"CsnBase\\": "vendor/coolcsn/csn-base/src/"
}
}
}
25 changes: 25 additions & 0 deletions composer.doctrineODM.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "zendframework/skeleton-application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2"
],
"homepage": "http://framework.zend.com/",
"minimum-stability": "alpha",
"repositories": [
{
"type": "composer",
"url": "http://packages.zendframework.com/"
}
],
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "2.*",
"zendframework/zendservice-recaptcha": "2.*",
"doctrine/common": ">=2.1",
"doctrine/doctrine-orm-module": "0.*",
"doctrine/doctrine-mongo-odm-module": "dev-master"
}
}
1 change: 1 addition & 0 deletions config/application.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
'KrasimirTsvetanov',
'Fmi',
'Auth',
'CsnBase', // This is also a library. Can be used without adding it as a module in composer.json: "autoload": {"psr-0": {"CsnBase\\": "vendor/coolcsn/csn-base/src/"}}
),
'module_listener_options' => array(
'config_glob_paths' => array(
Expand Down
16 changes: 16 additions & 0 deletions config/autoload/mail.config.local.php.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
return array(
'mail' => array(
'transport' => array(
'options' => array(
'host' => 'smtp.gmail.com',
'connection_class' => 'plain',
'connection_config' => array(
'username' => '[email protected]',
'password' => '',
'ssl' => 'tls'
),
),
),
),
);
40 changes: 39 additions & 1 deletion module/Auth/Module.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<?php
namespace Auth;

// Add this for Table Date Gateway
use Auth\Model\Auth;
use Auth\Model\UsersTable;
use Zend\Db\ResultSet\ResultSet;
use Zend\Db\TableGateway\TableGateway;

// Add this for SMTP transport
use Zend\ServiceManager\ServiceManager;
use Zend\Mail\Transport\Smtp;
use Zend\Mail\Transport\SmtpOptions;

class Module
{

Expand All @@ -18,5 +29,32 @@ public function getAutoloaderConfig()
),
),
);
}
}

public function getServiceConfig()
{
return array(
'factories' => array(
// For Yable data Gateway
'Auth\Model\UsersTable' => function($sm) {
$tableGateway = $sm->get('UsersTableGateway');
$table = new UsersTable($tableGateway);
return $table;
},
'UsersTableGateway' => function ($sm) {
$dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
$resultSetPrototype = new ResultSet();
$resultSetPrototype->setArrayObjectPrototype(new Auth()); // Notice what is set here
return new TableGateway('users', $dbAdapter, null, $resultSetPrototype);
},
// Add this for SMTP transport
'mail.transport' => function (ServiceManager $serviceManager) {
$config = $serviceManager->get('Config');
$transport = new Smtp();
$transport->setOptions(new SmtpOptions($config['mail']['transport']['options']));
return $transport;
},
),
);
}
}
4 changes: 3 additions & 1 deletion module/Auth/config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
'controllers' => array(
'invokables' => array(
'Auth\Controller\Index' => 'Auth\Controller\IndexController',
'Auth\Controller\Registration' => 'Auth\Controller\RegistrationController',
),
),
'router' => array(
Expand All @@ -23,10 +24,11 @@
'default' => array(
'type' => 'Segment',
'options' => array(
'route' => '/[:controller[/:action]]',
'route' => '/[:controller[/:action[/:id]]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[a-zA-Z0-9_-]*',
),
'defaults' => array(
),
Expand Down
Loading

0 comments on commit 8e70ced

Please sign in to comment.