diff --git a/app/config/config.yml b/app/config/config.yml
index e899119..1b96d02 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -61,11 +61,14 @@ doctrine:
# Swiftmailer Configuration
swiftmailer:
- transport: "%mailer_transport%"
- host: "%mailer_host%"
- username: "%mailer_user%"
- password: "%mailer_password%"
- spool: { type: memory }
+ transport: %mailer_transport%
+ host: %mailer_host%
+ port: %mailer_port%
+ username: %mailer_user%
+ encryption: %mailer_encryption%
+ auth_mode: %mailer_auth_mode%
+ password: %mailer_password%
+
stof_doctrine_extensions:
default_locale: en_US
diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist
index df1aaf7..c2f88f4 100644
--- a/app/config/parameters.yml.dist
+++ b/app/config/parameters.yml.dist
@@ -14,7 +14,9 @@ parameters:
mailer_host: 127.0.0.1
mailer_user: ~
mailer_password: ~
- mailer_from: ~
+ mailer_encryption: ssl
+ mailer_auth_mode: login
+ mailer_port: 465
# A secret key that's used to generate certain security-related tokens
secret: ThisTokenIsNotSoSecretChangeIt
diff --git a/app/config/security.yml b/app/config/security.yml
index 17d4f4e..70a86fc 100644
--- a/app/config/security.yml
+++ b/app/config/security.yml
@@ -38,7 +38,7 @@ security:
google: "/login/check-google"
login_path: /
use_forward: false
- default_target_path: /registrationNet
+ default_target_path: /account/update-profile
failure_path: /
oauth_user_provider:
service: oauth_test_provider
diff --git a/app/config/services.xml b/app/config/services.xml
index 17d60a0..c0f8175 100644
--- a/app/config/services.xml
+++ b/app/config/services.xml
@@ -72,7 +72,7 @@
- %mailer_from%
+ %mailer_user%
diff --git a/install.sh b/install.sh
index 098f010..4d80e39 100644
--- a/install.sh
+++ b/install.sh
@@ -24,8 +24,8 @@ case "$Keypress" in
composer install
./node_modules/.bin/bower install
./node_modules/.bin/gulp
- php app/console doctrine:database:drop --force
- php app/console doctrine:database:create
+ #php app/console doctrine:database:drop --force
+ #php app/console doctrine:database:create
php app/console doctrine:schema:update --force
app/console app:admin_create admin@admin.net admin Admin Admin
;;
diff --git a/src/AppBundle/Controller/RegistrationController.php b/src/AppBundle/Controller/RegistrationController.php
index 84f11bd..8e7798a 100644
--- a/src/AppBundle/Controller/RegistrationController.php
+++ b/src/AppBundle/Controller/RegistrationController.php
@@ -27,7 +27,7 @@ public function registerAction(Request $request)
}
/**
- * @Route("/registrationNet", name="net_registration")
+ * @Route("/account/update-profile", name="update_profile")
* @Template("@App/registration/updateRegistration.html.twig")
*/
public function registerSocialNetAction(Request $request)
@@ -35,7 +35,7 @@ public function registerSocialNetAction(Request $request)
$user = $this->getUser();
if ($user) {
- if ($user->getIsReg() === false) {
+ if (!$user->getPassword()) {
return $this->get('app.registration.user')
->updateRegistrationUser($request, $user);
}
@@ -78,8 +78,7 @@ public function checkUserHash($hash, $email)
->findOneBy(array('email' => $email, 'hash' => $hash));
if ($user) {
-
- $user->setIsReg(true);
+ $user->setIsActive(true);
$user->setHash(null);
$this->addFlash('notice', 'You have successfully passed registration confirmation');
@@ -106,11 +105,12 @@ public function recoveryPassword(Request $request)
$user = $em->getRepository('AppBundle:User')
->findOneBy(['email' => $email]);
- if ($user && $user->getIsReg() == true) {
+ if ($user && $user->isAccountNonLocked() == true) {
$password = $this->get('app.custom.mailer')->sendMailRecovery($email);
$newPassword = $this->get('security.password_encoder')
->encodePassword($user, $password);
$user->setPassword($newPassword);
+ $user->setIsActive(true);
$em->flush();
$this->addFlash('notice', 'The new password is sent to your email');
@@ -121,8 +121,8 @@ public function recoveryPassword(Request $request)
$this->addFlash('notice', 'Email is incorrectly specified');
return $this->redirectToRoute('homepage');
- } elseif ($user && $user->getIsReg() == false) {
- $this->addFlash('notice', 'You aren\'t registered');
+ } elseif ($user && $user->isAccountNonLocked() == false) {
+ $this->addFlash('notice', 'You are blocked');
return $this->redirectToRoute('homepage');
} else {
diff --git a/src/AppBundle/DataFixtures/ORM/Data/users.yml b/src/AppBundle/DataFixtures/ORM/Data/users.yml
index f61c4b3..63c2728 100644
--- a/src/AppBundle/DataFixtures/ORM/Data/users.yml
+++ b/src/AppBundle/DataFixtures/ORM/Data/users.yml
@@ -5,18 +5,18 @@ AppBundle\Entity\User:
email(unique): user1@mail.ru
password:
role: ROLE_USER
- isReg: true
+ isActive: true
user2:
firstName:
lastName:
email(unique): user2@mail.ru
password:
role: ROLE_USER
- isReg: true
+ isActive: true
user3:
firstName:
lastName:
email(unique): user3@mail.ru
password:
role: ROLE_USER
- isReg: true
\ No newline at end of file
+ isActive: true
\ No newline at end of file
diff --git a/src/AppBundle/DataFixtures/ORM/DataForTests/test.yml b/src/AppBundle/DataFixtures/ORM/DataForTests/test.yml
index a1f661c..50e66d5 100644
--- a/src/AppBundle/DataFixtures/ORM/DataForTests/test.yml
+++ b/src/AppBundle/DataFixtures/ORM/DataForTests/test.yml
@@ -3,18 +3,18 @@ AppBundle\Entity\User:
password:
email: admin@test.com
isActive: true
- isReg: true
role: "ROLE_ADMIN"
firstName: "Admin"
lastName: "Admin"
+ isActive: true
user2:
password:
email: user@test.com
isActive: true
- isReg: true
role: "ROLE_USER"
firstName: "User"
lastName: "User"
+ isActive: true
AppBundle\Entity\Category:
category1:
diff --git a/src/AppBundle/Entity/User.php b/src/AppBundle/Entity/User.php
index 1e8b244..3164d9a 100644
--- a/src/AppBundle/Entity/User.php
+++ b/src/AppBundle/Entity/User.php
@@ -98,9 +98,9 @@ class User implements AdvancedUserInterface, \JsonSerializable
protected $type;
/**
- * @ORM\Column(name="is_reg", type="boolean")
+ * @ORM\Column(name="is_locked", type="boolean")
*/
- protected $isReg;
+ protected $isLocked;
/**
* @ORM\Column(name="hash", type="string", nullable=true)
@@ -121,14 +121,10 @@ public function jsonSerialize()
];
}
-
- /**
- *
- */
public function __construct()
{
$this->isActive = false;
- $this->isReg = false;
+ $this->isLocked = false;
$this->modulesUser = new ArrayCollection();
$this->role = self::ROLE_USER;
}
@@ -324,7 +320,7 @@ public function isAccountNonExpired()
*/
public function isAccountNonLocked()
{
- return true;
+ return $this->isLocked ? false : true ;
}
/**
@@ -360,6 +356,23 @@ public function setIsActive($active)
return $this->isActive = $active;
}
+ /**
+ * @return bool
+ */
+ public function getIsLocked()
+ {
+ return $this->isLocked;
+ }
+
+ /**
+ * @param $isLocked
+ * @return mixed
+ */
+ public function setIsLocked($isLocked)
+ {
+ return $this->isLocked = $isLocked;
+ }
+
/**
* @return string
*/
@@ -370,6 +383,7 @@ public function getFacebookToken()
/**
* @param string $facebookToken
+ * @return $this
*/
public function setFacebookToken($facebookToken)
{
@@ -388,6 +402,7 @@ public function getFacebookId()
/**
* @param string $facebookId
+ * @return $this
*/
public function setFacebookId($facebookId)
{
@@ -406,6 +421,7 @@ public function getGoogleToken()
/**
* @param string $googleToken
+ * @return $this
*/
public function setGoogleToken($googleToken)
{
@@ -424,6 +440,7 @@ public function getGoogleId()
/**
* @param string $googleId
+ * @return $this
*/
public function setGoogleId($googleId)
{
@@ -456,24 +473,6 @@ public function getType()
return $this->type;
}
- /**
- * @return mixed
- */
- public function getIsReg()
- {
- return $this->isReg;
- }
-
- /**
- * @param mixed $isReg
- */
- public function setIsReg($isReg)
- {
- $this->isReg = $isReg;
-
- return $this;
- }
-
/**
* @return mixed
*/
@@ -484,6 +483,7 @@ public function getHash()
/**
* @param mixed $hash
+ * @return $this
*/
public function setHash($hash)
{
diff --git a/src/AppBundle/Form/UpdateUserSocialNetType.php b/src/AppBundle/Form/UpdateUserSocialNetType.php
index f79f8c5..2e69bc2 100644
--- a/src/AppBundle/Form/UpdateUserSocialNetType.php
+++ b/src/AppBundle/Form/UpdateUserSocialNetType.php
@@ -36,6 +36,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
])
->add('plain_password', RepeatedType::class, [
'type' => PasswordType::class,
+ 'required' => false,
'invalid_message' => 'The password fields must match.',
'options' => [
'attr' => [
diff --git a/src/AppBundle/Form/UpdateUserType.php b/src/AppBundle/Form/UpdateUserType.php
index 942e8b9..19f4755 100644
--- a/src/AppBundle/Form/UpdateUserType.php
+++ b/src/AppBundle/Form/UpdateUserType.php
@@ -35,8 +35,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'placeholder' => 'enter last name'
]
])
- ->add('is_active', CheckboxType::class, [
- 'label' => 'Active',
+ ->add('is_locked', CheckboxType::class, [
+ 'label' => 'Locked',
'required' => false
]);
}
diff --git a/src/AppBundle/Form/UserType.php b/src/AppBundle/Form/UserType.php
index 29a32df..5c2c630 100644
--- a/src/AppBundle/Form/UserType.php
+++ b/src/AppBundle/Form/UserType.php
@@ -18,19 +18,16 @@ public function buildForm(FormBuilderInterface $builder, array $options)
->add('email', EmailType::class, [
'attr' => [
'class' => 'form-control',
- 'placeholder' => 'enter email'
]
])
->add('firstName', TextType::class, [
'attr' => [
'class' => 'form-control',
- 'placeholder' => 'enter first name'
]
])
->add('lastName', TextType::class, [
'attr' => [
'class' => 'form-control',
- 'placeholder' => 'enter last name'
]
])
->add('plain_password', RepeatedType::class, [
@@ -39,9 +36,10 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'options' => [
'attr' => [
'class' => 'form-control',
- 'placeholder' => 'enter password'
]
- ]
+ ],
+ 'first_options' => ['label' => 'Password'],
+ 'second_options' => ['label' => 'Repeat Password'],
]
);
}
diff --git a/src/AppBundle/Resources/views/Emails/registration.html.twig b/src/AppBundle/Resources/views/Emails/registration.html.twig
index 12b3929..e2f0f30 100644
--- a/src/AppBundle/Resources/views/Emails/registration.html.twig
+++ b/src/AppBundle/Resources/views/Emails/registration.html.twig
@@ -1,6 +1,6 @@
You did it! You registered!
{# example, assuming you have a route named "login" #}
-For completion of registration follow the link: CHECK REGISTER.
+For completion of registration follow the link: CHECK REGISTER.
Thanks!
\ No newline at end of file
diff --git a/src/AppBundle/Resources/views/admin/user/showUser.html.twig b/src/AppBundle/Resources/views/admin/user/showUser.html.twig
index f5515d0..88e4bc8 100644
--- a/src/AppBundle/Resources/views/admin/user/showUser.html.twig
+++ b/src/AppBundle/Resources/views/admin/user/showUser.html.twig
@@ -15,6 +15,7 @@