diff --git a/LICENSE b/LICENSE index f957eb2..a369bab 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (C) 2013 Stoyan Cheresharov, Niko Vasilev, Stoyan Revov and Svetoslav Chonkov +Copyright (C) 2013 Stoyan Cheresharov, Niko Vasilev, Stoyan Revov, Svetoslav Chonkov and Martin Briglia Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, diff --git a/README.md b/README.md index a8637ad..06eb470 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,10 @@ CsnUser requires setting up a Connection for Doctrine, a simple Mail configurati 5. Append the contents of `./vendor/coolcsn/CsnUser/data/CsnUser.css` to APP_ROOT/public/css/styles.css or include `CsnUser.css` into your app. +Default User +------------ +CsnUser by default provides you with an admin user for you to test. Login with this user using `administrator` as the username and `superadmin` as the password. + Options ------- @@ -78,6 +82,19 @@ The following options are available: >### It is ready? ### Navigate to *[hostname]/user* in your browser to view different options for login, registration, forgotten password, etc. +Enable module translations +-------------------------- +If you wish to enable module translations, you need to add this array to `translation_file_patterns` key in your `translator` key in Zend Skeleton Application **Application** module config `module.config.php` file. After that, you may proceed to create your own translation files that are located in `CsnUser/language` + +``` +array( + 'type' => 'gettext', + 'base_dir' => __DIR__ . '/../../CsnUser/language', + 'pattern' => '%s.mo', + 'text_domain' => 'csnuser', +) +``` + Routes ------------ The following routes are available: @@ -85,7 +102,7 @@ The following routes are available: - **user** Welcome view. - **user/login** User login view. - **user/register** User register view. -- **user/register/reset-password** User resep password view. +- **user/register/reset-password** User reset password view. - **user/register/edit-profile** User edit profile view. - **user/register/change-password** User change password view. - **user/register/change-email** User change email view. @@ -110,4 +127,7 @@ Recommends - [coolcsn/CsnCms](https://github.com/coolcsn/CsnCms) - Content management system; +Known Issues +------------ +- **ZendDeveloperTools:** Enabling *ZendDeveloperTools* module makes Doctrine ORM Annotation Builder fail. You can enable *ZendDeveloperTools*, but for annotated form creation test, you need to disable it first or annotated forms will not render at all. diff --git a/composer.json b/composer.json index 588ca6e..c63e0cd 100644 --- a/composer.json +++ b/composer.json @@ -32,6 +32,11 @@ "email": "st.revov@gmail.com", "role": "Developer" } + { + "name": "Martin Briglia", + "email": "martin@mgscreativa.com", + "role": "Developer" + } ], "minimum-stability": "dev", "require": { diff --git a/config/csnuser.global.php.dist b/config/csnuser.global.php.dist index 0a64a0f..9657468 100644 --- a/config/csnuser.global.php.dist +++ b/config/csnuser.global.php.dist @@ -23,22 +23,42 @@ return array( * * Upon successful login the user will be redirected to the entered route * - * Default value: 'user' + * Default value: 'user-index'' * Accepted values: A valid route name within your application * */ 'login_redirect_route' => 'user-index', + + /** + * Login Redirect Route Options + * + * Options for the login redirect route + * + * Default value: empty array + * Accepted values: array of accepted route options + */ + 'login_redirect_route_options' => array(), /** * Logout Redirect Route * * Upon logging out the user will be redirected to the enterd route * - * Default value: 'user' + * Default value: 'user-index'' * Accepted values: A valid route name within your application */ 'logout_redirect_route' => 'user-index', + /** + * Logout Redirect Route Options + * + * Options for the Logout Redirect Route + * + * Default value: empty array + * Accepted values: array of accepted route options + */ + 'logout_redirect_route_options' => array(), + /** * Sender email dadress * @@ -67,7 +87,16 @@ return array( * Accepted values: int */ 'captcha_char_num' => 3, - + + /** + * Set max idle user time in minutes, used to logout user in case of + * inactivity. Dont set it too high! + * + * Default value: 15 + * Accepted values: int + */ + 'session_life_time' => 15, + /** * Visibility of exception details * @@ -79,4 +108,4 @@ return array( */ 'display_exceptions' => true, ), -); +); \ No newline at end of file diff --git a/config/module.config.php b/config/module.config.php index ad2a272..5449391 100644 --- a/config/module.config.php +++ b/config/module.config.php @@ -78,6 +78,7 @@ 'service_manager' => array ( 'factories' => array( 'Zend\Authentication\AuthenticationService' => 'CsnUser\Service\Factory\AuthenticationFactory', + 'Zend\Session\SessionManager' => 'Zend\Session\Service\SessionManagerFactory', 'mail.transport' => 'CsnUser\Service\Factory\MailTransportFactory', 'csnuser_module_options' => 'CsnUser\Service\Factory\ModuleOptionsFactory', 'csnuser_error_view' => 'CsnUser\Service\Factory\ErrorViewFactory', diff --git a/data/CsnUser.css b/data/CsnUser.css index 28ca797..9557dce 100644 --- a/data/CsnUser.css +++ b/data/CsnUser.css @@ -20,6 +20,11 @@ table.users-list td, table.users-list th { text-align: center; } + +table.users-list td.name-column, +table.users-list td.email-column { + text-align: left; +} table.users-list a.name { color: #3389D1; diff --git a/data/SampleData.sql b/data/SampleData.sql index 8eaa0ae..2f9f7e5 100644 --- a/data/SampleData.sql +++ b/data/SampleData.sql @@ -14,18 +14,11 @@ INSERT INTO `language` (`id`, `name`, `abbreviation`) VALUES -- Dumping data for table `role` -- -INSERT INTO `role` (`id`, `name`) VALUES -(1, 'Guest'), -(2, 'Member'), -(3, 'Admin'); - --- --- Dumping data for table `roles_parents` --- - -INSERT INTO `roles_parents` (`role_id`, `parent_id`) VALUES -(2, 1), -(3, 2); +INSERT INTO `role` (`id`, `name`, `description`) VALUES +(1, 'Guest', 'This is the not logged in user role, should not be applyed to any user.'), +(2, 'User', 'Should get almost view permissions only, and maybe some create/edit permissions'), +(3, 'Manager', 'Manages everithing except deletions'), +(4, 'Admin', 'The super user, he can do anything'); -- -- Dumping data for table `questions` @@ -38,9 +31,17 @@ INSERT INTO `question` (`id`, `question`) VALUES (4, 'In what city or town was your first job?'); -- --- Dumping data for table `questions` +-- Dumping data for table `state` -- INSERT INTO `state` (`id`, `state`) VALUES (1, 'Disabled'), (2, 'Enabled'); + +-- +-- Dumping data for table `user` +-- + +INSERT INTO `user` (`id`, `role_id`, `language_id`, `state_id`, `question_id`, `username`, `first_name`, `last_name`, `email`, `password`, `answer`, `picture`, `registration_date`, `registration_token`, `email_confirmed`) VALUES +(1, 4, 1, 2, 3, 'administrator', 'Admin', 'Istrator', 'admin@istrator.com', '$2y$10$GUKeGz/rLU74nVN85c5OveH02Ymiq7gxxYoNbU6anwbjG/gzW2z8W', 'who knows', NULL, NULL, NULL, 1); + diff --git a/language/en_US.mo b/language/en_US.mo new file mode 100644 index 0000000..c4a5946 Binary files /dev/null and b/language/en_US.mo differ diff --git a/language/en_US.po b/language/en_US.po new file mode 100644 index 0000000..ad68a00 --- /dev/null +++ b/language/en_US.po @@ -0,0 +1,430 @@ +msgid "" +msgstr "" +"Project-Id-Version: CsnUser\n" +"POT-Creation-Date: 2014-05-16 20:18-0300\n" +"PO-Revision-Date: 2014-05-16 20:19-0300\n" +"Last-Translator: Martin Briglia \n" +"Language-Team: CoolCsn\n" +"Language: en_US\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.5.4\n" +"X-Poedit-KeywordsList: translate\n" +"X-Poedit-Basepath: .\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Poedit-SearchPath-0: ..\n" + +#: ../src/CsnUser/Service/Factory/UserFormFactory.php:250 +#: ../view/csn-user/registration/registration.phtml:83 +msgid "Sign In" +msgstr "" + +#: ../src/CsnUser/Service/Factory/UserFormFactory.php:379 +msgid "This username is already taken" +msgstr "" + +#: ../src/CsnUser/Service/Factory/UserFormFactory.php:389 +#: ../src/CsnUser/Service/Factory/UserFormFactory.php:468 +msgid "An user with this email already exists" +msgstr "" + +#: ../src/CsnUser/Controller/IndexController.php:92 +#: ../src/CsnUser/Controller/IndexController.php:102 +#: ../src/CsnUser/Controller/IndexController.php:148 +msgid "Your authentication credentials are not valid" +msgstr "" + +#: ../src/CsnUser/Controller/IndexController.php:100 +msgid "Your username is disabled. Please contact an administrator." +msgstr "" + +#: ../src/CsnUser/Controller/IndexController.php:138 +msgid "Something went wrong during login! Please, try again later." +msgstr "" + +#: ../src/CsnUser/Controller/RegistrationController.php:83 +msgid "Please, confirm your registration!" +msgstr "" + +#: ../src/CsnUser/Controller/RegistrationController.php:84 +#, php-format +msgid "Please, click the link to confirm your registration => %s" +msgstr "" + +#: ../src/CsnUser/Controller/RegistrationController.php:97 +#: ../src/CsnUser/Controller/RegistrationController.php:245 +msgid "" +"Something went wrong when trying to send activation email! Please, try again " +"later." +msgstr "" + +#: ../src/CsnUser/Controller/RegistrationController.php:144 +msgid "Your profile has been edited" +msgstr "" + +#: ../src/CsnUser/Controller/RegistrationController.php:190 +msgid "Your answer is wrong. Please provide the correct answer." +msgstr "" + +#: ../src/CsnUser/Controller/RegistrationController.php:230 +msgid "Please, confirm your request to change password!" +msgstr "" + +#: ../src/CsnUser/Controller/RegistrationController.php:231 +#, php-format +msgid "" +"Hi, %s. Please, follow this link %s to confirm your request to change " +"password." +msgstr "" + +#: ../src/CsnUser/Controller/RegistrationController.php:296 +msgid "Your current password is not correct." +msgstr "" + +#: ../src/CsnUser/Controller/RegistrationController.php:336 +msgid "Your password is wrong. Please provide the correct password." +msgstr "" + +#: ../src/CsnUser/Controller/RegistrationController.php:373 +msgid "" +"Something went wrong during the activation of your account! Please, try " +"again later." +msgstr "" + +#: ../src/CsnUser/Controller/RegistrationController.php:402 +#, php-format +msgid "" +"Hello again %s. Your new password is: %s. Please, follow this link %s to log " +"in with your new password." +msgstr "" + +#: ../src/CsnUser/Controller/RegistrationController.php:418 +msgid "" +"An error occured during the confirmation of your password change! Please, " +"try again later." +msgstr "" + +#: ../src/CsnUser/Controller/AdminController.php:94 +msgid "User created Successfully" +msgstr "" + +#: ../src/CsnUser/Controller/AdminController.php:101 +msgid "Something went wrong during user creation! Please, try again later." +msgstr "" + +#: ../src/CsnUser/Controller/AdminController.php:130 +#: ../src/CsnUser/Controller/AdminController.php:186 +msgid "User ID invalid" +msgstr "" + +#: ../src/CsnUser/Controller/AdminController.php:149 +#: ../src/CsnUser/Controller/AdminController.php:236 +msgid "User Updated Successfully" +msgstr "" + +#: ../src/CsnUser/Controller/AdminController.php:156 +msgid "" +"Something went wrong during update user process! Please, try again later." +msgstr "" + +#: ../src/CsnUser/Controller/AdminController.php:195 +msgid "User Deleted Successfully" +msgstr "" + +#: ../src/CsnUser/Controller/AdminController.php:199 +#: ../src/CsnUser/Controller/AdminController.php:240 +msgid "" +"Something went wrong during user delete process! Please, try again later." +msgstr "" + +#: ../src/CsnUser/Controller/AdminController.php:226 +msgid "User ID or state invalid" +msgstr "" + +#: ../view/csn-user/layout/nav-menu.phtml:18 +msgid "User Home" +msgstr "" + +#: ../view/csn-user/layout/nav-menu.phtml:21 +#: ../view/csn-user/registration/edit-profile.phtml:54 +msgid "Edit Profile" +msgstr "" + +#: ../view/csn-user/layout/nav-menu.phtml:24 +#: ../view/csn-user/index/index.phtml:28 +msgid "Log Out" +msgstr "" + +#: ../view/csn-user/layout/nav-menu.phtml:29 +msgid "Log in" +msgstr "" + +#: ../view/csn-user/layout/nav-menu.phtml:32 +#: ../view/csn-user/registration/registration.phtml:78 +#: ../view/csn-user/registration/registration.phtml:89 +msgid "Sign Up" +msgstr "" + +#: ../view/csn-user/layout/nav-menu.phtml:35 +#: ../view/csn-user/registration/reset-password.phtml:48 +msgid "Reset Password" +msgstr "" + +#: ../view/csn-user/registration/confirm-email-success.phtml:21 +msgid "Thank you! Your registration has been confirmed." +msgstr "" + +#: ../view/csn-user/registration/registration.phtml:31 +#: ../view/csn-user/admin/edit-user-form.phtml:30 +#: ../view/csn-user/admin/new-user-form.phtml:30 +msgid "Username" +msgstr "" + +#: ../view/csn-user/registration/registration.phtml:37 +#: ../view/csn-user/registration/edit-profile.phtml:32 +#: ../view/csn-user/admin/edit-user-form.phtml:36 +#: ../view/csn-user/admin/new-user-form.phtml:36 +msgid "First Name" +msgstr "" + +#: ../view/csn-user/registration/registration.phtml:43 +#: ../view/csn-user/registration/edit-profile.phtml:38 +#: ../view/csn-user/admin/edit-user-form.phtml:42 +#: ../view/csn-user/admin/new-user-form.phtml:42 +msgid "Last Name" +msgstr "" + +#: ../view/csn-user/registration/registration.phtml:48 +#: ../view/csn-user/registration/edit-profile.phtml:75 +#: ../view/csn-user/admin/edit-user-form.phtml:48 +#: ../view/csn-user/admin/new-user-form.phtml:48 +msgid "Your Email" +msgstr "" + +#: ../view/csn-user/registration/registration.phtml:53 +#: ../view/csn-user/index/login.phtml:36 +#: ../view/csn-user/admin/new-user-form.phtml:53 +msgid "Password" +msgstr "" + +#: ../view/csn-user/registration/registration.phtml:58 +#: ../view/csn-user/admin/new-user-form.phtml:58 +msgid "Confirm Password" +msgstr "" + +#: ../view/csn-user/registration/registration.phtml:67 +#: ../view/csn-user/admin/edit-user-form.phtml:74 +#: ../view/csn-user/admin/new-user-form.phtml:84 +msgid "Type Your Answer" +msgstr "" + +#: ../view/csn-user/registration/registration.phtml:73 +#: ../view/csn-user/registration/reset-password.phtml:37 +#: ../view/csn-user/index/login.phtml:50 +msgid "Verify you are human" +msgstr "" + +#: ../view/csn-user/registration/confirm-email-change-password.phtml:21 +#, php-format +msgid "" +"Confirmation successful! You have a new password. An email has been sent to " +"%s with your new password." +msgstr "" + +#: ../view/csn-user/registration/change-email-success.phtml:21 +msgid "Thank you! Your email has been changed to " +msgstr "" + +#: ../view/csn-user/registration/password-change-success.phtml:21 +#, php-format +msgid "" +"An email has been sent to %s. Please, check " +"your inbox and confirm your request to change password!" +msgstr "" + +#: ../view/csn-user/registration/change-security-question-success.phtml:21 +msgid "Thank you! Your security question has been changed" +msgstr "" + +#: ../view/csn-user/registration/change-password-success.phtml:21 +msgid "Thank you! Your password has been changed successfully." +msgstr "" + +#: ../view/csn-user/registration/change-password.phtml:31 +msgid "Confirm New Password" +msgstr "" + +#: ../view/csn-user/registration/change-password.phtml:36 +#: ../view/csn-user/registration/change-password.phtml:42 +#: ../view/csn-user/registration/edit-profile.phtml:71 +#: ../view/csn-user/admin/edit-user-form.phtml:121 +msgid "Change Password" +msgstr "" + +#: ../view/csn-user/registration/change-password.phtml:53 +msgid "Security Question" +msgstr "" + +#: ../view/csn-user/registration/change-password.phtml:57 +#: ../view/csn-user/registration/change-security-question.phtml:63 +msgid "Security Answer" +msgstr "" + +#: ../view/csn-user/registration/change-password.phtml:62 +msgid "New Password" +msgstr "" + +#: ../view/csn-user/registration/reset-password.phtml:31 +msgid "Write Your Username or Email" +msgstr "" + +#: ../view/csn-user/registration/reset-password.phtml:42 +msgid "Send Reset Email" +msgstr "" + +#: ../view/csn-user/registration/change-security-question.phtml:36 +#: ../view/csn-user/registration/change-security-question.phtml:42 +#: ../view/csn-user/registration/edit-profile.phtml:87 +msgid "Change Security Question" +msgstr "" + +#: ../view/csn-user/registration/change-security-question.phtml:52 +#: ../view/csn-user/registration/change-email.phtml:57 +msgid "Current Password" +msgstr "" + +#: ../view/csn-user/registration/change-email.phtml:31 +msgid "New Email" +msgstr "" + +#: ../view/csn-user/registration/change-email.phtml:36 +msgid "Confirm New Email" +msgstr "" + +#: ../view/csn-user/registration/change-email.phtml:41 +#: ../view/csn-user/registration/change-email.phtml:47 +#: ../view/csn-user/registration/edit-profile.phtml:79 +msgid "Change Email" +msgstr "" + +#: ../view/csn-user/registration/registration-success.phtml:21 +#, php-format +msgid "" +"An email has been sent to %s. Please, check " +"your inbox and confirm your registration!" +msgstr "" + +#: ../view/csn-user/registration/edit-profile.phtml:48 +msgid "Update Profile" +msgstr "" + +#: ../view/csn-user/registration/edit-profile.phtml:65 +msgid "Your Username" +msgstr "" + +#: ../view/csn-user/registration/edit-profile.phtml:68 +msgid "Your Password" +msgstr "" + +#: ../view/csn-user/registration/edit-profile.phtml:83 +msgid "Your Security Question" +msgstr "" + +#: ../view/csn-user/registration/edit-profile.phtml:91 +msgid "Your First/Last Name" +msgstr "" + +#: ../view/csn-user/registration/edit-profile.phtml:109 +msgid "Your Language" +msgstr "" + +#: ../view/csn-user/index/login.phtml:31 +msgid "Username or Email" +msgstr "" + +#: ../view/csn-user/index/login.phtml:40 +msgid "Activate Remember Me Function" +msgstr "" + +#: ../view/csn-user/index/login.phtml:44 +msgid "Remember me?" +msgstr "" + +#: ../view/csn-user/index/login.phtml:55 ../view/csn-user/index/login.phtml:61 +msgid "Log In" +msgstr "" + +#: ../view/csn-user/index/login.phtml:105 +msgid "Sign up" +msgstr "" + +#: ../view/csn-user/index/login.phtml:108 +msgid "Forgot your password?" +msgstr "" + +#: ../view/csn-user/index/index.phtml:22 ../view/csn-user/index/index.phtml:35 +msgid "Welcome" +msgstr "" + +#: ../view/csn-user/index/index.phtml:32 +msgid "Congratulations! You have successfully logged in." +msgstr "" + +#: ../view/csn-user/index/index.phtml:35 +msgid "Guest" +msgstr "" + +#: ../view/csn-user/index/index.phtml:37 +msgid "Please follow the buttons at the top to navigate through the system." +msgstr "" + +#: ../view/csn-user/admin/edit-user-form.phtml:79 +#: ../view/csn-user/admin/edit-user-form.phtml:86 +msgid "Edit User" +msgstr "" + +#: ../view/csn-user/admin/new-user-form.phtml:89 +#: ../view/csn-user/admin/index.phtml:37 +msgid "Create User" +msgstr "" + +#: ../view/csn-user/admin/new-user-form.phtml:96 +msgid "New User" +msgstr "" + +#: ../view/csn-user/admin/index.phtml:34 +msgid "Users Admin Table" +msgstr "" + +#: ../view/csn-user/admin/index.phtml:45 +msgid "Name" +msgstr "" + +#: ../view/csn-user/admin/index.phtml:46 +msgid "Email" +msgstr "" + +#: ../view/csn-user/admin/index.phtml:47 +msgid "State" +msgstr "" + +#: ../view/csn-user/admin/index.phtml:48 +msgid "Actions" +msgstr "" + +#: ../view/csn-user/admin/index.phtml:68 +msgid "Enable" +msgstr "" + +#: ../view/csn-user/admin/index.phtml:71 +msgid "Edit" +msgstr "" + +#: ../view/csn-user/admin/index.phtml:73 +msgid "Do you really want to delete this user?" +msgstr "" + +#: ../view/csn-user/admin/index.phtml:74 +msgid "Delete" +msgstr "" diff --git a/src/CsnUser/Controller/AdminController.php b/src/CsnUser/Controller/AdminController.php index af2928f..38b1df0 100755 --- a/src/CsnUser/Controller/AdminController.php +++ b/src/CsnUser/Controller/AdminController.php @@ -56,7 +56,7 @@ class AdminController extends AbstractActionController public function indexAction() { if(!$this->identity()) { - return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute()); + return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute(), $this->getOptions()->getLoginRedirectRouteOptions()); } $users = $this->getEntityManager()->getRepository('CsnUser\Entity\User')->findall(); @@ -64,7 +64,7 @@ public function indexAction() } /** - * Create action + * Create user action * * Method to create an user * @@ -73,17 +73,16 @@ public function indexAction() public function createUserAction() { if(!$this->identity()) { - return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute()); + return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute(), $this->getOptions()->getLoginRedirectRouteOptions()); } try { $user = new User; $form = $this->getUserFormHelper()->createUserForm($user, 'CreateUser'); - $request = $this->getRequest(); - if ($request->isPost()) { + if ($this->getRequest()->isPost()) { $form->setValidationGroup('username', 'email', 'firstName', 'lastName', 'password', 'passwordVerify', 'language', 'state', 'role', 'question', 'answer', 'csrf'); - $form->setData($request->getPost()); + $form->setData($this->getRequest()->getPost()); if ($form->isValid()) { $entityManager = $this->getEntityManager(); $user->setEmailConfirmed(false); @@ -92,14 +91,14 @@ public function createUserAction() $user->setPassword(UserCredentialsService::encryptPassword($user->getPassword())); $entityManager->persist($user); $entityManager->flush(); - $this->flashMessenger()->addSuccessMessage($this->getTranslatorHelper()->translate('User created Successfully')); + $this->flashMessenger()->addSuccessMessage($this->getTranslatorHelper()->translate('User created Successfully', 'csnuser')); return $this->redirect()->toRoute('user-admin'); } } } catch (\Exception $e) { return $this->getServiceLocator()->get('csnuser_error_view')->createErrorView( - $this->getTranslatorHelper()->translate('Something went wrong during user creation! Please, try again later.'), + $this->getTranslatorHelper()->translate('Something went wrong during user creation! Please, try again later.', 'csnuser'), $e, $this->getOptions()->getDisplayExceptions(), false @@ -112,7 +111,7 @@ public function createUserAction() } /** - * Edit action + * Edit user action * * Method to update an user * @@ -121,14 +120,14 @@ public function createUserAction() public function editUserAction() { if(!$this->identity()) { - return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute()); + return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute(), $this->getOptions()->getLoginRedirectRouteOptions()); } try { $id = (int) $this->params()->fromRoute('id', 0); if ($id == 0) { - $this->flashMessenger()->addErrorMessage($this->getTranslatorHelper()->translate('User ID invalid')); + $this->flashMessenger()->addErrorMessage($this->getTranslatorHelper()->translate('User ID invalid', 'csnuser')); return $this->redirect()->toRoute('user-admin'); } @@ -140,22 +139,21 @@ public function editUserAction() $form->setAttributes(array( 'action' => $this->url()->fromRoute('user-admin', array('action' => 'edit-user', 'id' => $id)), )); - - $request = $this->getRequest(); - if ($request->isPost()) { + + if ($this->getRequest()->isPost()) { $form->setValidationGroup('username', 'email', 'firstName', 'lastName', 'language', 'state', 'role', 'question', 'answer', 'csrf'); - $form->setData($request->getPost()); + $form->setData($this->getRequest()->getPost()); if ($form->isValid()) { $entityManager->persist($user); $entityManager->flush(); - $this->flashMessenger()->addSuccessMessage($this->getTranslatorHelper()->translate('User Updated Successfully')); + $this->flashMessenger()->addSuccessMessage($this->getTranslatorHelper()->translate('User Updated Successfully', 'csnuser')); return $this->redirect()->toRoute('user-admin'); } } } catch (\Exception $e) { return $this->getServiceLocator()->get('csnuser_error_view')->createErrorView( - $this->getTranslatorHelper()->translate('Something went wrong during update user process! Please, try again later.'), + $this->getTranslatorHelper()->translate('Something went wrong during update user process! Please, try again later.', 'csnuser'), $e, $this->getOptions()->getDisplayExceptions(), false @@ -164,14 +162,13 @@ public function editUserAction() $viewModel = new ViewModel(array( 'form' => $form, - 'headerLabel' => $this->getTranslatorHelper()->translate('Edit User').' - '.$user->getDisplayName(), )); $viewModel->setTemplate('csn-user/admin/edit-user-form'); return $viewModel; } /** - * Delete action + * Delete user action * * Method to delete an user from his ID * @@ -180,13 +177,13 @@ public function editUserAction() public function deleteUserAction() { if(!$this->identity()) { - return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute()); + return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute(), $this->getOptions()->getLoginRedirectRouteOptions()); } $id = (int) $this->params()->fromRoute('id', 0); if ($id == 0) { - $this->flashMessenger()->addErrorMessage($this->getTranslatorHelper()->translate('User ID invalid')); + $this->flashMessenger()->addErrorMessage($this->getTranslatorHelper()->translate('User ID invalid', 'csnuser')); return $this->redirect()->toRoute('user-admin'); } @@ -195,11 +192,11 @@ public function deleteUserAction() $user = $entityManager->getRepository('CsnUser\Entity\User')->find($id); $entityManager->remove($user); $entityManager->flush(); - $this->flashMessenger()->addSuccessMessage($this->getTranslatorHelper()->translate('User Deleted Successfully')); + $this->flashMessenger()->addSuccessMessage($this->getTranslatorHelper()->translate('User Deleted Successfully', 'csnuser')); } catch (\Exception $e) { return $this->getServiceLocator()->get('csnuser_error_view')->createErrorView( - $this->getTranslatorHelper()->translate('Something went wrong during user delete process! Please, try again later.'), + $this->getTranslatorHelper()->translate('Something went wrong during user delete process! Please, try again later.', 'csnuser'), $e, $this->getOptions()->getDisplayExceptions(), false @@ -210,7 +207,7 @@ public function deleteUserAction() } /** - * Disable action + * Disable user action * * Method to disable an user from his ID * @@ -219,14 +216,14 @@ public function deleteUserAction() public function setUserStateAction() { if(!$this->identity()) { - return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute()); + return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute(), $this->getOptions()->getLoginRedirectRouteOptions()); } $id = (int) $this->params()->fromRoute('id', 0); $state = (int) $this->params()->fromRoute('state', -1); if ($id === 0 || $state === -1) { - $this->flashMessenger()->addErrorMessage($this->getTranslatorHelper()->translate('User ID or state invalid')); + $this->flashMessenger()->addErrorMessage($this->getTranslatorHelper()->translate('User ID or state invalid', 'csnuser')); return $this->redirect()->toRoute('user-admin'); } @@ -236,11 +233,11 @@ public function setUserStateAction() $user->setState($entityManager->find('CsnUser\Entity\State', $state)); $entityManager->persist($user); $entityManager->flush(); - $this->flashMessenger()->addSuccessMessage($this->getTranslatorHelper()->translate('User Updated Successfully')); + $this->flashMessenger()->addSuccessMessage($this->getTranslatorHelper()->translate('User Updated Successfully', 'csnuser')); } catch (\Exception $e) { return $this->getServiceLocator()->get('csnuser_error_view')->createErrorView( - $this->getTranslatorHelper()->translate('Something went wrong during user delete process! Please, try again later.'), + $this->getTranslatorHelper()->translate('Something went wrong during user delete process! Please, try again later.', 'csnuser'), $e, $this->getOptions()->getDisplayExceptions(), false @@ -305,4 +302,4 @@ private function getUserFormHelper() return $this->userFormHelper; } -} \ No newline at end of file +} diff --git a/src/CsnUser/Controller/IndexController.php b/src/CsnUser/Controller/IndexController.php index 69bf6da..208aa47 100644 --- a/src/CsnUser/Controller/IndexController.php +++ b/src/CsnUser/Controller/IndexController.php @@ -16,8 +16,6 @@ use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; -use Zend\Session\SessionManager; -use Zend\Session\Config\StandardConfig; use CsnUser\Entity\User; use CsnUser\Options\ModuleOptions; @@ -69,13 +67,13 @@ public function indexAction() public function loginAction() { if ($user = $this->identity()) { - return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute()); + return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute(), $this->getOptions()->getLoginRedirectRouteOptions()); } $user = new User; $form = $this->getUserFormHelper()->createUserForm($user, 'login'); $messages = null; - if ($this->getRequest()->isPost()) { + if($this->getRequest()->isPost()) { $form->setValidationGroup('usernameOrEmail', 'password', 'rememberme', 'csrf', 'captcha'); $form->setData($this->getRequest()->getPost()); if ($form->isValid()) { @@ -91,7 +89,7 @@ public function loginAction() if(!isset($user)) { $message = 'The username or email is not valid!'; return new ViewModel(array( - 'error' => $this->getTranslatorHelper()->translate('Your authentication credentials are not valid'), + 'error' => $this->getTranslatorHelper()->translate('Your authentication credentials are not valid', 'csnuser'), 'form' => $form, 'messages' => $messages, 'navMenu' => $this->getOptions()->getNavMenu() @@ -99,9 +97,9 @@ public function loginAction() } if($user->getState()->getId() < 2) { - $messages = $this->getTranslatorHelper()->translate('Your username is disabled. Please contact an administrator.'); + $messages = $this->getTranslatorHelper()->translate('Your username is disabled. Please contact an administrator.', 'csnuser'); return new ViewModel(array( - 'error' => $this->getTranslatorHelper()->translate('Your authentication credentials are not valid'), + 'error' => $this->getTranslatorHelper()->translate('Your authentication credentials are not valid', 'csnuser'), 'form' => $form, 'messages' => $messages, 'navMenu' => $this->getOptions()->getNavMenu() @@ -117,12 +115,19 @@ public function loginAction() $authService->getStorage()->write($identity); if ($this->params()->fromPost('rememberme')) { - $time = 1209600; // 14 days (1209600/3600 = 336 hours => 336/24 = 14 days) - $sessionManager = new SessionManager(); - $sessionManager->rememberMe($time); + $useCookies = true; + $cookieLifeTime = 14 * 24 * 60 * 60; + } else { + $useCookies = false; + $cookieLifeTime = 0; } - - return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute()); + $sessionManager = $this->getServiceLocator()->get('Zend\Session\SessionManager'); + $sessionManager->getConfig()->setUseCookies($useCookies); + $sessionManager->getConfig()->setCookieHttpOnly(true); + $sessionManager->getConfig()->setRememberMeSeconds(60 * $this->getOptions()->getSessionLifeTime()); + $sessionManager->rememberMe($cookieLifeTime); + + return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute(), $this->getOptions()->getLoginRedirectRouteOptions()); } foreach ($authResult->getMessages() as $message) { @@ -130,7 +135,7 @@ public function loginAction() } } catch (\Exception $e) { return $this->getServiceLocator()->get('csnuser_error_view')->createErrorView( - $this->getTranslatorHelper()->translate('Something went wrong during login! Please, try again later.'), + $this->getTranslatorHelper()->translate('Something went wrong during login! Please, try again later.', 'csnuser'), $e, $this->getOptions()->getDisplayExceptions(), $this->getOptions()->getNavMenu() @@ -140,7 +145,7 @@ public function loginAction() } return new ViewModel(array( - 'error' => $this->getTranslatorHelper()->translate('Your authentication credentials are not valid'), + 'error' => $this->getTranslatorHelper()->translate('Your authentication credentials are not valid', 'csnuser'), 'form' => $form, 'messages' => $messages, 'navMenu' => $this->getOptions()->getNavMenu() @@ -156,14 +161,18 @@ public function loginAction() */ public function logoutAction() { + if (!$user = $this->identity()) { + return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute(), $this->getOptions()->getLoginRedirectRouteOptions()); + } + $auth = $this->getServiceLocator()->get('Zend\Authentication\AuthenticationService'); if ($auth->hasIdentity()) { $auth->clearIdentity(); - $sessionManager = new SessionManager(); + $sessionManager = $this->getServiceLocator()->get('Zend\Session\SessionManager'); $sessionManager->forgetMe(); } - return $this->redirect()->toRoute($this->getOptions()->getLogoutRedirectRoute()); + return $this->redirect()->toRoute($this->getOptions()->getLogoutRedirectRoute(), $this->getOptions()->getLogoutRedirectRouteOptions()); } /** diff --git a/src/CsnUser/Controller/RegistrationController.php b/src/CsnUser/Controller/RegistrationController.php index a13c7df..8d25279 100644 --- a/src/CsnUser/Controller/RegistrationController.php +++ b/src/CsnUser/Controller/RegistrationController.php @@ -58,7 +58,7 @@ class RegistrationController extends AbstractActionController public function indexAction() { if($this->identity()) { - return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute()); + return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute(), $this->getOptions()->getLoginRedirectRouteOptions()); } $user = new User; @@ -80,8 +80,8 @@ public function indexAction() $fullLink = $this->getBaseUrl() . $this->url()->fromRoute('user-register', array('action' => 'confirm-email', 'id' => $user->getRegistrationToken())); $this->sendEmail( $user->getEmail(), - $this->getTranslatorHelper()->translate('Please, confirm your registration!'), - sprintf($this->getTranslatorHelper()->translate('Please, click the link to confirm your registration => %s'), $fullLink) + $this->getTranslatorHelper()->translate('Please, confirm your registration!', 'csnuser'), + sprintf($this->getTranslatorHelper()->translate('Please, click the link to confirm your registration => %s', 'csnuser'), $fullLink) ); $entityManager->persist($user); $entityManager->flush(); @@ -94,7 +94,7 @@ public function indexAction() return $viewModel; } catch (\Exception $e) { return $this->getServiceLocator()->get('csnuser_error_view')->createErrorView( - $this->getTranslatorHelper()->translate('Something went wrong when trying to send activation email! Please, try again later.'), + $this->getTranslatorHelper()->translate('Something went wrong when trying to send activation email! Please, try again later.', 'csnuser'), $e, $this->getOptions()->getDisplayExceptions(), $this->getOptions()->getNavMenu() @@ -121,7 +121,7 @@ public function indexAction() public function editProfileAction() { if(!$user = $this->identity()) { - return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute()); + return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute(), $this->getOptions()->getLoginRedirectRouteOptions()); } $form = $this->getUserFormHelper()->createUserForm($user, 'EditProfile'); @@ -141,7 +141,7 @@ public function editProfileAction() $entityManager = $this->getEntityManager(); $entityManager->persist($user); $entityManager->flush(); - $message = $this->getTranslatorHelper()->translate('Your profile has been edited'); + $message = $this->getTranslatorHelper()->translate('Your profile has been edited', 'csnuser'); } } @@ -165,7 +165,7 @@ public function editProfileAction() public function changePasswordAction() { if(!$user = $this->identity()) { - return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute()); + return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute(), $this->getOptions()->getLoginRedirectRouteOptions()); } $form = $this->getUserFormHelper()->createUserForm($user, 'ChangePassword'); @@ -187,7 +187,7 @@ public function changePasswordAction() $viewModel->setTemplate('csn-user/registration/change-password-success'); return $viewModel; } else { - $message = $this->getTranslatorHelper()->translate('Your answer is wrong. Please provide the correct answer.'); + $message = $this->getTranslatorHelper()->translate('Your answer is wrong. Please provide the correct answer.', 'csnuser'); } } } @@ -205,7 +205,7 @@ public function changePasswordAction() public function resetPasswordAction() { if($user = $this->identity()) { - return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute()); + return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute(), $this->getOptions()->getLoginRedirectRouteOptions()); } $user = new User; @@ -227,8 +227,8 @@ public function resetPasswordAction() $fullLink = $this->getBaseUrl() . $this->url()->fromRoute('user-register', array( 'action' => 'confirm-email-change-password', 'id' => $user->getRegistrationToken())); $this->sendEmail( $user->getEmail(), - $this->getTranslatorHelper()->translate('Please, confirm your request to change password!'), - sprintf($this->getTranslatorHelper()->translate('Hi, %s. Please, follow this link %s to confirm your request to change password.'), $user->getUsername(), $fullLink) + $this->getTranslatorHelper()->translate('Please, confirm your request to change password!', 'csnuser'), + sprintf($this->getTranslatorHelper()->translate('Hi, %s. Please, follow this link %s to confirm your request to change password.', 'csnuser'), $user->getUsername(), $fullLink) ); $entityManager->persist($user); $entityManager->flush(); @@ -242,7 +242,7 @@ public function resetPasswordAction() return $viewModel; } catch (\Exception $e) { return $this->getServiceLocator()->get('csnuser_error_view')->createErrorView( - $this->getTranslatorHelper()->translate('Something went wrong when trying to send activation email! Please, try again later.'), + $this->getTranslatorHelper()->translate('Something went wrong when trying to send activation email! Please, try again later.', 'csnuser'), $e, $this->getOptions()->getDisplayExceptions(), $this->getOptions()->getNavMenu() @@ -267,7 +267,7 @@ public function resetPasswordAction() public function changeEmailAction() { if(!$user = $this->identity()) { - return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute()); + return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute(), $this->getOptions()->getLoginRedirectRouteOptions()); } $form = $this->getUserFormHelper()->createUserForm($user, 'ChangeEmail'); @@ -293,7 +293,7 @@ public function changeEmailAction() $viewModel->setTemplate('csn-user/registration/change-email-success'); return $viewModel; } else { - $message = $this->getTranslatorHelper()->translate('Your current password is not correct.'); + $message = $this->getTranslatorHelper()->translate('Your current password is not correct.', 'csnuser'); } } } @@ -311,7 +311,7 @@ public function changeEmailAction() public function changeSecurityQuestionAction() { if(!$user = $this->identity()) { - return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute()); + return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute(), $this->getOptions()->getLoginRedirectRouteOptions()); } $form = $this->getUserFormHelper()->createUserForm($user, 'ChangeSecurityQuestion'); @@ -333,7 +333,7 @@ public function changeSecurityQuestionAction() $viewModel->setTemplate('csn-user/registration/change-security-question-success'); return $viewModel; } else { - $message = $this->getTranslatorHelper()->translate('Your password is wrong. Please provide the correct password.'); + $message = $this->getTranslatorHelper()->translate('Your password is wrong. Please provide the correct password.', 'csnuser'); } } } @@ -370,7 +370,7 @@ public function confirmEmailAction() } } catch (\Exception $e) { return $this->getServiceLocator()->get('csnuser_error_view')->createErrorView( - $this->getTranslatorHelper()->translate('Something went wrong during the activation of your account! Please, try again later.'), + $this->getTranslatorHelper()->translate('Something went wrong during the activation of your account! Please, try again later.', 'csnuser'), $e, $this->getOptions()->getDisplayExceptions(), $this->getOptions()->getNavMenu() @@ -399,7 +399,7 @@ public function confirmEmailChangePasswordAction() $this->sendEmail( $user->getEmail(), 'Your password has been changed!', - sprintf($this->getTranslatorHelper()->translate('Hello again %s. Your new password is: %s. Please, follow this link %s to log in with your new password.'), $user->getUsername(), $password, $fullLink) + sprintf($this->getTranslatorHelper()->translate('Hello again %s. Your new password is: %s. Please, follow this link %s to log in with your new password.', 'csnuser'), $user->getUsername(), $password, $fullLink) ); $entityManager->persist($user); @@ -415,7 +415,7 @@ public function confirmEmailChangePasswordAction() } } catch (\Exception $e) { return $this->getServiceLocator()->get('csnuser_error_view')->createErrorView( - $this->getTranslatorHelper()->translate('An error occured during the confirmation of your password change! Please, try again later.'), + $this->getTranslatorHelper()->translate('An error occured during the confirmation of your password change! Please, try again later.', 'csnuser'), $e, $this->getOptions()->getDisplayExceptions(), $this->getOptions()->getNavMenu() diff --git a/src/CsnUser/Entity/Language.php b/src/CsnUser/Entity/Language.php index 53563ad..451cda5 100644 --- a/src/CsnUser/Entity/Language.php +++ b/src/CsnUser/Entity/Language.php @@ -17,10 +17,10 @@ use Doctrine\ORM\Mapping as ORM; /** - * Language + * Doctrine ORM implementation of Language entity * - * @ORM\Table(name="language") * @ORM\Entity + * @ORM\Table(name="`language`") */ class Language { diff --git a/src/CsnUser/Entity/Question.php b/src/CsnUser/Entity/Question.php index 46c9c9c..3a492e6 100644 --- a/src/CsnUser/Entity/Question.php +++ b/src/CsnUser/Entity/Question.php @@ -17,10 +17,10 @@ use Doctrine\ORM\Mapping as ORM; /** - * Questions + * Doctrine ORM implementation of Question entity * - * @ORM\Table(name="question") * @ORM\Entity + * @ORM\Table(name="`question`") */ class Question { diff --git a/src/CsnUser/Entity/Role.php b/src/CsnUser/Entity/Role.php index e60a663..2c1cdd2 100644 --- a/src/CsnUser/Entity/Role.php +++ b/src/CsnUser/Entity/Role.php @@ -16,13 +16,12 @@ use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\ArrayCollection; -use Doctrine\Common\Collections\Collection; /** - * Role + * Doctrine ORM implementation of Role entity * - * @ORM\Table(name="role") * @ORM\Entity + * @ORM\Table(name="`role`") */ class Role { @@ -31,30 +30,38 @@ class Role * * @ORM\Column(name="id", type="integer") * @ORM\Id + * @ORM\GeneratedValue(strategy="IDENTITY") */ protected $id; /** * @var string * - * @ORM\Column(name="name", type="string", length=15, nullable=false) + * @ORM\Column(name="name", type="string", length=30, nullable=false, unique=true) */ protected $name; + + /** + * @var string + * + * @ORM\Column(name="description", type="string", length=100, nullable=false) + */ + protected $roleDescription; /** - * @var Array - * - * @ORM\ManyToMany(targetEntity="Role", cascade={"persist"}) - * @ORM\JoinTable(name="roles_parents", - * joinColumns={@ORM\JoinColumn(name="role_id", referencedColumnName="id")}, - * inverseJoinColumns={@ORM\JoinColumn(name="parent_id", referencedColumnName="id")} - * ) + * @var Privilege + * @ORM\OneToMany(targetEntity="CsnAuthorization\Entity\Privilege", mappedBy="role", cascade={"persist", "remove"}, orphanRemoval=true) */ - protected $parents; + protected $privilege; + /** + * Construct + * + * Construct some referenced columns arrays + */ public function __construct() { - $this->parents = new ArrayCollection; + $this->privilege = new ArrayCollection; } /** @@ -91,26 +98,48 @@ public function getName() } /** - * Set parents + * Set role description * - * @param Array $parent + * @param string $roleDescription * @return Role */ - public function setParents($parents) + public function setRoleDescription($roleDescription) { - $this->parents = $parents; - + $this->roleDescription = $roleDescription; + return $this; } + + /** + * Get role description + * + * @return string + */ + public function getRoleDescription() + { + return $this->roleDescription; + } + + /** + * Set privilege + * + * @param $privilege + * @return Role + */ + public function setPrivilege($privilege) + { + $this->privilege = $privilege; + return $this; + } + /** - * Get parents + * Get privilege * * @return Array */ - public function getParents() + public function getPrivilege() { - return $this->parents; + return $this->privilege; } - } diff --git a/src/CsnUser/Entity/State.php b/src/CsnUser/Entity/State.php index f3b05f2..c8d58db 100644 --- a/src/CsnUser/Entity/State.php +++ b/src/CsnUser/Entity/State.php @@ -17,10 +17,10 @@ use Doctrine\ORM\Mapping as ORM; /** - * State + * Doctrine ORM implementation of State entity * - * @ORM\Table(name="state") * @ORM\Entity + * @ORM\Table(name="`state`") */ class State { diff --git a/src/CsnUser/Entity/User.php b/src/CsnUser/Entity/User.php index 5804cd8..10cc387 100644 --- a/src/CsnUser/Entity/User.php +++ b/src/CsnUser/Entity/User.php @@ -14,11 +14,10 @@ namespace CsnUser\Entity; -use Doctrine\ORM\Mapping as ORM; use Zend\Form\Annotation; +use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\ArrayCollection; -use Doctrine\Common\Collections\Collection; /** * Doctrine ORM implementation of User entity @@ -34,7 +33,7 @@ class User /** * @var integer * - * @ORM\Column(name="id", type="integer") + * @ORM\Column(name="id", type="integer", nullable=false) * @ORM\Id * @ORM\GeneratedValue(strategy="IDENTITY") * @Annotation\Exclude() @@ -124,7 +123,7 @@ class User * @Annotation\Required(true) * @Annotation\Options({ * "required":"true", - * "empty_option": "User Role", + * "empty_option": "Select User Role", * "target_class":"CsnUser\Entity\Role", * "property": "name" * }) @@ -237,12 +236,13 @@ class User protected $emailConfirmed; /** - * @ORM\ManyToMany(targetEntity="User", mappedBy="myFriends") + * @ORM\ManyToMany(targetEntity="CsnUser\Entity\User", mappedBy="myFriends") + * @Annotation\Exclude() **/ protected $friendsWithMe; /** - * @ORM\ManyToMany(targetEntity="User", inversedBy="friendsWithMe") + * @ORM\ManyToMany(targetEntity="CsnUser\Entity\User", inversedBy="friendsWithMe") * @ORM\JoinTable(name="friends", * joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")}, * inverseJoinColumns={@ORM\JoinColumn(name="friend_id", referencedColumnName="id")} diff --git a/src/CsnUser/Module.php b/src/CsnUser/Module.php index 506b8e4..0067618 100644 --- a/src/CsnUser/Module.php +++ b/src/CsnUser/Module.php @@ -14,8 +14,32 @@ namespace CsnUser; +use Zend\Session\Container; +use Zend\Session\SessionManager; +use Zend\Session\Config\SessionConfig; +use Zend\EventManager\EventInterface; + class Module { + /*public function onBootstrap(EventInterface $event) + { + $serviceManager = $event->getApplication()->getServiceManager(); + $sessionLifeTime = $serviceManager->get('csnuser_module_options')->getSessionLifeTime(); + $host = $serviceManager->get('Request')->getUri()->getHost(); + + $sessionConfig = new SessionConfig(); + $sessionConfig->setOptions(array( + 'cookie_httponly' => true, + 'cookie_domain' => $host, + 'gc_maxlifetime' => 60*$sessionLifeTime, + 'remember_me_seconds' => 60*$sessionLifeTime, + )); + + $sessionManager = new SessionManager($sessionConfig); + $sessionManager->start(); + Container::setDefaultManager($sessionManager); + }*/ + public function getConfig() { return include __DIR__ . '/../../config/module.config.php'; diff --git a/src/CsnUser/Options/ModuleOptions.php b/src/CsnUser/Options/ModuleOptions.php index bc1f634..b9ffc93 100644 --- a/src/CsnUser/Options/ModuleOptions.php +++ b/src/CsnUser/Options/ModuleOptions.php @@ -27,11 +27,21 @@ class ModuleOptions extends AbstractOptions * @var string */ protected $loginRedirectRoute = 'user'; + + /** + * @var array + */ + protected $loginRedirectRouteOptions = array(); /** * @var string */ protected $logoutRedirectRoute = 'user'; + + /** + * @var array + */ + protected $logoutRedirectRouteOptions = array(); /** * @var string @@ -44,17 +54,20 @@ class ModuleOptions extends AbstractOptions protected $navMenu = true; /** - * @var bool + * @var int */ - protected $displayExceptions = true; - protected $captchaCharNum = 3; /** - * @var string + * @var int */ - protected $authenticationService = 'doctrine.authenticationservice.orm_default'; + protected $sessionLifeTime = 15; + /** + * @var bool + */ + protected $displayExceptions = true; + /** * set login redirect route * @@ -77,6 +90,29 @@ public function getLoginRedirectRoute() { return $this->loginRedirectRoute; } + + /** + * set login redirect route options + * + * @param array $loginRedirectRouteOptions + * @return ModuleOptions + */ + public function setLoginRedirectRouteOptions($loginRedirectRouteOptions) + { + $this->loginRedirectRouteOptions = $loginRedirectRouteOptions; + + return $this; + } + + /** + * get login redirect route options + * + * @return array + */ + public function getLoginRedirectRouteOptions() + { + return $this->loginRedirectRouteOptions; + } /** * set logout redirect route @@ -100,6 +136,29 @@ public function getLogoutRedirectRoute() { return $this->logoutRedirectRoute; } + + /** + * set logout redirect route options + * + * @param array $logoutRedirectRouteOptions + * @return ModuleOptions + */ + public function setLogoutRedirectRouteOptions($logoutRedirectRouteOptions) + { + $this->logoutRedirectRouteOptions = $logoutRedirectRouteOptions; + + return $this; + } + + /** + * get logout redirect route options + * + * @return array + */ + public function getLogoutRedirectRouteOptions() + { + return $this->logoutRedirectRouteOptions; + } /** * set sender email address @@ -148,72 +207,70 @@ public function getNavMenu() } /** - * set display exceptions + * set captcha number of characters * - * @param bool $displayExceptions - * @return ModuleOptions + * @return int */ - public function setDisplayExceptions($displayExceptions) + public function setCaptchaCharNum($captchaCharNum) { - $this->displayExceptions = $displayExceptions; - - return $this; + $this->captchaCharNum = $captchaCharNum; + + return $this->captchaCharNum; } /** - * get visibility of exception error messages + * get captcha number of characters * - * @return bool + * @return int */ - public function getDisplayExceptions() + public function getCaptchaCharNum() { - return $this->displayExceptions; + return $this->captchaCharNum; } /** - * set captcha number of characters + * set session life time * - * @return int + * @param bool $sessionLifeTime + * @return ModuleOptions */ - public function setCaptchaCharNum($captchaCharNum) + public function setSessionLifeTime($sessionLifeTime) { - $this->captchaCharNum = $captchaCharNum; - - return $this->captchaCharNum; + $this->displayExceptions = $sessionLifeTime; + + return $this; } /** - * get captcha number of characters + * get session life time * * @return int */ - public function getCaptchaCharNum() + public function getSessionLifeTime() { - return $this->captchaCharNum; + return $this->sessionLifeTime; } - /** - * set authentication service from config file + * set display exceptions * - * @param bool $authenticationService + * @param bool $displayExceptions * @return ModuleOptions */ - public function setAuthenticationService($authenticationService) + public function setDisplayExceptions($displayExceptions) { - $this->authenticationService = $authenticationService; - - return $this; + $this->displayExceptions = $displayExceptions; + + return $this; } /** - * get authentication service from config file + * get visibility of exception error messages * - * @return string + * @return bool */ - public function getAuthenticationService() + public function getDisplayExceptions() { - return $this->authenticationService; + return $this->displayExceptions; } - } diff --git a/src/CsnUser/Service/Factory/UserFormFactory.php b/src/CsnUser/Service/Factory/UserFormFactory.php index 7c2d420..66012e0 100644 --- a/src/CsnUser/Service/Factory/UserFormFactory.php +++ b/src/CsnUser/Service/Factory/UserFormFactory.php @@ -52,7 +52,7 @@ class UserFormFactory implements FactoryInterface protected $translatorHelper; /** - * @var Zend\Mvc\I18n\Translator + * @var Zend\Mvc\Controller\Plugin\Url */ protected $url; @@ -142,7 +142,7 @@ public function createUserForm($userEntity, $formName = 'LogIn') case 'EditUser': $this->form->setAttributes(array( - 'name' => 'register' + 'name' => 'edit-user' )); break; @@ -173,7 +173,7 @@ private function addCommonFields() 'type' => 'Zend\Form\Element\Csrf', 'options' => array( 'csrf_options' => array( - 'timeout' => 600 + 'timeout' => 600, ) ) )); @@ -216,7 +216,9 @@ private function addLoginFields() 'name' => 'rememberme', 'type' => 'Zend\Form\Element\Checkbox', 'options' => array( - 'label' => $this->getTranslatorHelper()->translate('Remember me?'), + 'use_hidden_element' => true, + 'checked_value' => '1', + 'unchecked_value' => '0' ), )); } @@ -245,7 +247,7 @@ private function addSignUpFields() 'onclick' => 'window.location="'.$this->getUrlPlugin()->fromRoute('user-index', array('action' => 'login')).'"', ), 'options' => array( - 'label' => $this->getTranslatorHelper()->translate('Sign In'), + 'label' => $this->getTranslatorHelper()->translate('Sign In', 'csnuser'), ) )); } @@ -352,10 +354,10 @@ private function addLoginFilters() ), 'validators' => array( array( - 'name' => 'InArray', + 'name' => 'Regex', 'options' => array( - 'haystack' => array('0', '1'), - ), + 'pattern' => '/^[0-1]{1}$/', + ), ), ) ))); @@ -374,7 +376,7 @@ private function addSignUpFilters() 'object_repository' => $entityManager->getRepository('CsnUser\Entity\User'), 'fields' => array('username'), 'messages' => array( - 'objectFound' => $this->getTranslatorHelper()->translate('This username is already taken'), + 'objectFound' => $this->getTranslatorHelper()->translate('This username is already taken', 'csnuser'), ), )) ); @@ -384,7 +386,7 @@ private function addSignUpFilters() 'object_repository' => $entityManager->getRepository('CsnUser\Entity\User'), 'fields' => array('email'), 'messages' => array( - 'objectFound' => $this->getTranslatorHelper()->translate('An user with this email already exists'), + 'objectFound' => $this->getTranslatorHelper()->translate('An user with this email already exists', 'csnuser'), ), )) ); @@ -463,7 +465,7 @@ private function addChangeEmailFilters() 'object_repository' => $this->getEntityManager()->getRepository('CsnUser\Entity\User'), 'fields' => array('email'), 'messages' => array( - 'objectFound' => $this->getTranslatorHelper()->translate('An user with this email already exists'), + 'objectFound' => $this->getTranslatorHelper()->translate('An user with this email already exists', 'csnuser'), ), ), ), diff --git a/view/csn-user/admin/edit-user-form.phtml b/view/csn-user/admin/edit-user-form.phtml index 31d9c38..6bf9309 100644 --- a/view/csn-user/admin/edit-user-form.phtml +++ b/view/csn-user/admin/edit-user-form.phtml @@ -27,25 +27,25 @@ $form->setAttributes(array( $form->get('username')->setAttributes(array( 'required' => 'true', 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Username') + 'placeholder' => $this->translate('Username', 'csnuser') )); $form->get('firstName')->setAttributes(array( 'required' => 'false', 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('First Name') + 'placeholder' => $this->translate('First Name', 'csnuser') )); $form->get('lastName')->setAttributes(array( 'required' => 'false', 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Last Name') + 'placeholder' => $this->translate('Last Name', 'csnuser') )); $form->get('email')->setAttributes(array( 'required' => 'true', 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Your Email') + 'placeholder' => $this->translate('Your Email', 'csnuser') )); $form->get('language')->setAttributes(array( @@ -71,19 +71,19 @@ $form->get('question')->setAttributes(array( $form->get('answer')->setAttributes(array( 'required' => 'true', 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Type Your Answer') + 'placeholder' => $this->translate('Type Your Answer', 'csnuser') )); $form->get('submit')->setAttributes(array( 'class' => 'btn btn btn-success btn-lg', - 'value' => $this->translate('Edit User') + 'value' => $this->translate('Edit User', 'csnuser') )); $form->prepare(); ?>
-

translate('Edit User')?>

+

translate('Edit User', 'csnuser')?>

@@ -118,7 +118,7 @@ $form->prepare(); Change user Password: ******
- translate('Change Password'); ?> + translate('Change Password', 'csnuser'); ?>
diff --git a/view/csn-user/admin/index.phtml b/view/csn-user/admin/index.phtml index 02cd955..4bea485 100644 --- a/view/csn-user/admin/index.phtml +++ b/view/csn-user/admin/index.phtml @@ -31,10 +31,10 @@ $flashMessenger = $this->flashMessenger() render('success', array('alert', 'alert-dismissable', 'alert-success')); ?>

- translate('Users Admin Table') ?> + translate('Users Admin Table', 'csnuser') ?>

- translate('Create User') ?> + translate('Create User', 'csnuser') ?>
@@ -42,10 +42,10 @@ $flashMessenger = $this->flashMessenger() Id - translate('Name') ?> - translate('Email') ?> - translate('State') ?> - translate('Actions') ?> + translate('Name', 'csnuser') ?> + translate('Email', 'csnuser') ?> + translate('State', 'csnuser') ?> + translate('Actions', 'csnuser') ?> flashMessenger() ?> getId(); ?> - + getFirstName() . ' ' . $user->getLastName() ?> (getRole()->getName()?>) - getEmail(); ?> + getEmail(); ?> - translate($user->getState()->getState()) ?> + translate($user->getState()->getState(), 'csnuser') ?> - translate(($user->getState()->getId() == 1) ? 'Enable' : 'Disable') ?> + translate(($user->getState()->getId() == 1) ? 'Enable' : 'Disable', 'csnuser') ?> | - translate('Edit') ?> + translate('Edit', 'csnuser') ?> | - - translate('Delete') ?> + + translate('Delete', 'csnuser') ?> diff --git a/view/csn-user/admin/new-user-form.phtml b/view/csn-user/admin/new-user-form.phtml index 8a976dc..65ad93d 100755 --- a/view/csn-user/admin/new-user-form.phtml +++ b/view/csn-user/admin/new-user-form.phtml @@ -27,35 +27,35 @@ $form->setAttributes(array( $form->get('username')->setAttributes(array( 'required' => 'true', 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Username') + 'placeholder' => $this->translate('Username', 'csnuser') )); $form->get('firstName')->setAttributes(array( 'required' => 'false', 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('First Name') + 'placeholder' => $this->translate('First Name', 'csnuser') )); $form->get('lastName')->setAttributes(array( 'required' => 'false', 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Last Name') + 'placeholder' => $this->translate('Last Name', 'csnuser') )); $form->get('email')->setAttributes(array( 'required' => 'true', 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Your Email') + 'placeholder' => $this->translate('Your Email', 'csnuser') )); $form->get('password')->setAttributes(array( 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Password') + 'placeholder' => $this->translate('Password', 'csnuser') )); $form->get('passwordVerify')->setAttributes(array( 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Confirm Password') + 'placeholder' => $this->translate('Confirm Password', 'csnuser') )); $form->get('language')->setAttributes(array( @@ -81,19 +81,19 @@ $form->get('question')->setAttributes(array( $form->get('answer')->setAttributes(array( 'required' => 'true', 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Type Your Answer') + 'placeholder' => $this->translate('Type Your Answer', 'csnuser') )); $form->get('submit')->setAttributes(array( 'class' => 'btn btn btn-success btn-lg', - 'value' => $this->translate('Create User') + 'value' => $this->translate('Create User', 'csnuser') )); $form->prepare(); ?>
-

translate('New User')?>

+

translate('New User', 'csnuser')?>

diff --git a/view/csn-user/index/index.phtml b/view/csn-user/index/index.phtml index 26cc3ec..acef9dd 100644 --- a/view/csn-user/index/index.phtml +++ b/view/csn-user/index/index.phtml @@ -19,22 +19,22 @@ echo $this->partial('csn-user/layout/nav-menu', array('navMenu' => $this->navMen
identity()) { ?>

- translate('Welcome') ?> + translate('Welcome', 'csnuser') ?> escapeHtml($user->getUsername()); ?>

- translate('Log Out'); ?> + translate('Log Out', 'csnuser'); ?>
- translate('Congratulations! You have successfully logged in.') ?> + translate('Congratulations! You have successfully logged in.', 'csnuser') ?>
-

translate('Welcome') ?> translate('Guest') ?>!

+

translate('Welcome', 'csnuser') ?> translate('Guest', 'csnuser') ?>!

- translate('Please follow the buttons at the top to navigate through the system.') ?> + translate('Please follow the buttons at the top to navigate through the system.', 'csnuser') ?>
diff --git a/view/csn-user/index/login.phtml b/view/csn-user/index/login.phtml index d95ff05..a3abe42 100644 --- a/view/csn-user/index/login.phtml +++ b/view/csn-user/index/login.phtml @@ -28,33 +28,37 @@ $form->setAttributes(array( $form->get('usernameOrEmail')->setAttributes(array( 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Username or Email') + 'placeholder' => $this->translate('Username or Email', 'csnuser') )); $form->get('password')->setAttributes(array( 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Password') + 'placeholder' => $this->translate('Password', 'csnuser') )); $form->get('rememberme')->setAttributes(array( - //'class' => 'form-control input-lg', + 'title' => $this->translate('Activate Remember Me Function', 'csnuser'), )); +$form->get('rememberme')->setOptions(array( + 'label' => $this->translate('Remember me?', 'csnuser'), +)); + $form->get('captcha')->setAttributes(array( 'required' => 'true', 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Verify you are human') + 'placeholder' => $this->translate('Verify you are human', 'csnuser') )); $form->get('submit')->setAttributes(array( 'class' => 'btn btn btn-success btn-lg', - 'value' => $this->translate('Log In') + 'value' => $this->translate('Log In', 'csnuser') )); $form->prepare(); ?>
-

translate('Log In')?>

+

translate('Log In', 'csnuser')?>

@@ -98,10 +102,10 @@ $form->prepare(); diff --git a/view/csn-user/layout/nav-menu.phtml b/view/csn-user/layout/nav-menu.phtml index 0f867e7..6721533 100644 --- a/view/csn-user/layout/nav-menu.phtml +++ b/view/csn-user/layout/nav-menu.phtml @@ -15,24 +15,24 @@ if($this->navMenu == true){ if($this->user) { ?> - translate('User Home'); ?> + translate('User Home', 'csnuser'); ?> - translate('Edit Profile'); ?> + translate('Edit Profile', 'csnuser'); ?> - translate('Log Out'); ?> + translate('Log Out', 'csnuser'); ?> - translate('Log in'); ?> + translate('Log in', 'csnuser'); ?> - translate('Sign Up'); ?> + translate('Sign Up', 'csnuser'); ?> - translate('Reset Password'); ?> + translate('Reset Password', 'csnuser'); ?> diff --git a/view/csn-user/registration/change-email-success.phtml b/view/csn-user/registration/change-email-success.phtml index 499705c..ca6cb57 100644 --- a/view/csn-user/registration/change-email-success.phtml +++ b/view/csn-user/registration/change-email-success.phtml @@ -18,6 +18,6 @@ echo $this->partial('csn-user/layout/nav-menu', array('navMenu' => $this->navMen

- translate('Thank you! Your email has been changed to ') . '' . $this->email . '' ?> + translate('Thank you! Your email has been changed to ', 'csnuser') . '' . $this->email . '' ?>

diff --git a/view/csn-user/registration/change-email.phtml b/view/csn-user/registration/change-email.phtml index 5b2fe7b..a35578a 100644 --- a/view/csn-user/registration/change-email.phtml +++ b/view/csn-user/registration/change-email.phtml @@ -28,23 +28,23 @@ $form->setAttributes(array( $form->get('newEmail')->setAttributes(array( 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('New Email') + 'placeholder' => $this->translate('New Email', 'csnuser') )); $form->get('newEmailVerify')->setAttributes(array( 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Confirm New Email') + 'placeholder' => $this->translate('Confirm New Email', 'csnuser') )); $form->get('submit')->setAttributes(array( 'class' => 'btn btn btn-success btn-lg', - 'value' => $this->translate('Change Email') + 'value' => $this->translate('Change Email', 'csnuser') )); $form->prepare(); ?>
-

translate('Change Email')?>

+

translate('Change Email', 'csnuser')?>

@@ -54,7 +54,7 @@ $form->prepare(); message ?>
- + get('password'); echo $this->formElementErrors($element); diff --git a/view/csn-user/registration/change-password-success.phtml b/view/csn-user/registration/change-password-success.phtml index 0ac88be..61b48c2 100644 --- a/view/csn-user/registration/change-password-success.phtml +++ b/view/csn-user/registration/change-password-success.phtml @@ -18,6 +18,6 @@ echo $this->partial('csn-user/layout/nav-menu', array('navMenu' => $this->navMen

- translate('Thank you! Your password has been changed successfully.')?> + translate('Thank you! Your password has been changed successfully.', 'csnuser')?>

diff --git a/view/csn-user/registration/change-password.phtml b/view/csn-user/registration/change-password.phtml index 048754f..737ba63 100644 --- a/view/csn-user/registration/change-password.phtml +++ b/view/csn-user/registration/change-password.phtml @@ -28,18 +28,18 @@ $form->setAttributes(array( $form->get('newPasswordVerify')->setAttributes(array( 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Confirm New Password') + 'placeholder' => $this->translate('Confirm New Password', 'csnuser') )); $form->get('submit')->setAttributes(array( 'class' => 'btn btn btn-success btn-lg', - 'value' => $this->translate('Change Password') + 'value' => $this->translate('Change Password', 'csnuser') )); $form->prepare(); ?>
-

translate('Change Password')?>

+

translate('Change Password', 'csnuser')?>

@@ -50,16 +50,16 @@ $form->prepare();
- translate('Security Question') ?>: + translate('Security Question', 'csnuser') ?>:
question ?>
- + get('answer'); echo $this->formElementErrors($element); ?> - + get('password'); echo $this->formElementErrors($element); diff --git a/view/csn-user/registration/change-security-question-success.phtml b/view/csn-user/registration/change-security-question-success.phtml index 7941c40..a3fa011 100644 --- a/view/csn-user/registration/change-security-question-success.phtml +++ b/view/csn-user/registration/change-security-question-success.phtml @@ -18,6 +18,6 @@ echo $this->partial('csn-user/layout/nav-menu', array('navMenu' => $this->navMen

- translate('Thank you! Your security question has been changed') ?> + translate('Thank you! Your security question has been changed', 'csnuser') ?>

diff --git a/view/csn-user/registration/change-security-question.phtml b/view/csn-user/registration/change-security-question.phtml index 3dac747..cc0d798 100644 --- a/view/csn-user/registration/change-security-question.phtml +++ b/view/csn-user/registration/change-security-question.phtml @@ -33,13 +33,13 @@ $form->get('question')->setAttributes(array( $form->get('submit')->setAttributes(array( 'class' => 'btn btn btn-success btn-lg', - 'value' => $this->translate('Change Security Question') + 'value' => $this->translate('Change Security Question', 'csnuser') )); $form->prepare(); ?>
-

translate('Change Security Question')?>

+

translate('Change Security Question', 'csnuser')?>

@@ -49,7 +49,7 @@ $form->prepare(); message ?>
- + get('password'); //echo $this->formElement($element); @@ -60,7 +60,7 @@ $form->prepare(); echo $this->formElement($element); echo $this->formElementErrors($element); ?> - + get('answer'); echo $this->formElementErrors($element); diff --git a/view/csn-user/registration/confirm-email-change-password.phtml b/view/csn-user/registration/confirm-email-change-password.phtml index a94377c..a5d2642 100644 --- a/view/csn-user/registration/confirm-email-change-password.phtml +++ b/view/csn-user/registration/confirm-email-change-password.phtml @@ -18,6 +18,6 @@ echo $this->partial('csn-user/layout/nav-menu', array('navMenu' => $this->navMen

- translate('Confirmation successful! You have a new password. An email has been sent to %s with your new password.'), $email);?> + translate('Confirmation successful! You have a new password. An email has been sent to %s with your new password.', 'csnuser'), $email);?>

diff --git a/view/csn-user/registration/confirm-email-success.phtml b/view/csn-user/registration/confirm-email-success.phtml index 8881388..e0f2733 100644 --- a/view/csn-user/registration/confirm-email-success.phtml +++ b/view/csn-user/registration/confirm-email-success.phtml @@ -18,6 +18,6 @@ echo $this->partial('csn-user/layout/nav-menu', array('navMenu' => $this->navMen

- translate('Thank you! Your registration has been confirmed.') ?> + translate('Thank you! Your registration has been confirmed.', 'csnuser') ?>

diff --git a/view/csn-user/registration/edit-profile.phtml b/view/csn-user/registration/edit-profile.phtml index 406c16f..db9ffd1 100644 --- a/view/csn-user/registration/edit-profile.phtml +++ b/view/csn-user/registration/edit-profile.phtml @@ -29,13 +29,13 @@ $form->setAttributes(array( $form->get('firstName')->setAttributes(array( 'required' => 'false', 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('First Name') + 'placeholder' => $this->translate('First Name', 'csnuser') )); $form->get('lastName')->setAttributes(array( 'required' => 'false', 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Last Name') + 'placeholder' => $this->translate('Last Name', 'csnuser') )); $form->get('language')->setAttributes(array( @@ -45,13 +45,13 @@ $form->get('language')->setAttributes(array( $form->get('submit')->setAttributes(array( 'class' => 'btn btn btn-success btn-lg', - 'value' => $this->translate('Update Profile') + 'value' => $this->translate('Update Profile', 'csnuser') )); $form->prepare(); ?>
-

translate('Edit Profile')?>

+

translate('Edit Profile', 'csnuser')?>

@@ -62,33 +62,33 @@ $form->prepare();
- translate('Your Username') ?>: username ?> + translate('Your Username', 'csnuser') ?>: username ?>
- translate('Your Password') ?>: ****** + translate('Your Password', 'csnuser') ?>: ******
- translate('Change Password'); ?> + translate('Change Password', 'csnuser'); ?>
- translate('Your Email') ?>: + translate('Your Email', 'csnuser') ?>: email ?>
- translate('Change Email'); ?> + translate('Change Email', 'csnuser'); ?>
- translate('Your Security Question') ?>: + translate('Your Security Question', 'csnuser') ?>: securityQuestion ?>
- translate('Change Security Question'); ?> + translate('Change Security Question', 'csnuser'); ?>
- translate('Your First/Last Name') ?>: + translate('Your First/Last Name', 'csnuser') ?>:
@@ -106,7 +106,7 @@ $form->prepare(); ?>
- translate('Your Language') ?>: + translate('Your Language', 'csnuser') ?>:
get('language'); diff --git a/view/csn-user/registration/password-change-success.phtml b/view/csn-user/registration/password-change-success.phtml index 4d50ace..e41398d 100644 --- a/view/csn-user/registration/password-change-success.phtml +++ b/view/csn-user/registration/password-change-success.phtml @@ -18,6 +18,6 @@ echo $this->partial('csn-user/layout/nav-menu', array('navMenu' => $this->navMen

- translate('An email has been sent to %s. Please, check your inbox and confirm your request to change password!'), $email);?> + translate('An email has been sent to %s. Please, check your inbox and confirm your request to change password!', 'csnuser'), $email);?>

diff --git a/view/csn-user/registration/registration-success.phtml b/view/csn-user/registration/registration-success.phtml index 5f81f2b..48c90e7 100644 --- a/view/csn-user/registration/registration-success.phtml +++ b/view/csn-user/registration/registration-success.phtml @@ -18,6 +18,6 @@ echo $this->partial('csn-user/layout/nav-menu', array('navMenu' => $this->navMen

- translate('An email has been sent to %s. Please, check your inbox and confirm your registration!'), $email);?> + translate('An email has been sent to %s. Please, check your inbox and confirm your registration!', 'csnuser'), $email);?>

diff --git a/view/csn-user/registration/registration.phtml b/view/csn-user/registration/registration.phtml index 270615f..795d514 100644 --- a/view/csn-user/registration/registration.phtml +++ b/view/csn-user/registration/registration.phtml @@ -28,34 +28,34 @@ $form->setAttributes(array( $form->get('username')->setAttributes(array( 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Username') + 'placeholder' => $this->translate('Username', 'csnuser') )); $form->get('firstName')->setAttributes(array( 'required' => 'false', 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('First Name') + 'placeholder' => $this->translate('First Name', 'csnuser') )); $form->get('lastName')->setAttributes(array( 'required' => 'false', 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Last Name') + 'placeholder' => $this->translate('Last Name', 'csnuser') )); $form->get('email')->setAttributes(array( 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Your Email') + 'placeholder' => $this->translate('Your Email', 'csnuser') )); $form->get('password')->setAttributes(array( 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Password') + 'placeholder' => $this->translate('Password', 'csnuser') )); $form->get('passwordVerify')->setAttributes(array( 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Confirm Password') + 'placeholder' => $this->translate('Confirm Password', 'csnuser') )); $form->get('question')->setAttributes(array( @@ -64,29 +64,29 @@ $form->get('question')->setAttributes(array( $form->get('answer')->setAttributes(array( 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Type Your Answer') + 'placeholder' => $this->translate('Type Your Answer', 'csnuser') )); $form->get('captcha')->setAttributes(array( 'required' => 'true', 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Verify you are human') + 'placeholder' => $this->translate('Verify you are human', 'csnuser') )); $form->get('submit')->setAttributes(array( 'class' => 'btn btn btn-success btn-lg', - 'value' => $this->translate('Sign Up') + 'value' => $this->translate('Sign Up', 'csnuser') )); $form->get('login')->setAttributes(array( 'class' => 'btn btn btn-warning btn-lg', - 'label' => $this->translate('Sign In') + 'label' => $this->translate('Sign In', 'csnuser') )); $form->prepare(); ?>
-

translate('Sign Up')?>

+

translate('Sign Up', 'csnuser')?>

diff --git a/view/csn-user/registration/reset-password.phtml b/view/csn-user/registration/reset-password.phtml index 90605c7..5351a2a 100644 --- a/view/csn-user/registration/reset-password.phtml +++ b/view/csn-user/registration/reset-password.phtml @@ -28,24 +28,24 @@ $form->setAttributes(array( $form->get('usernameOrEmail')->setAttributes(array( 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Write Your Username or Email') + 'placeholder' => $this->translate('Write Your Username or Email', 'csnuser') )); $form->get('captcha')->setAttributes(array( 'required' => 'true', 'class' => 'form-control input-lg', - 'placeholder' => $this->translate('Verify you are human') + 'placeholder' => $this->translate('Verify you are human', 'csnuser') )); $form->get('submit')->setAttributes(array( 'class' => 'btn btn btn-success btn-lg', - 'value' => $this->translate('Send Reset Email') + 'value' => $this->translate('Send Reset Email', 'csnuser') )); $form->prepare(); ?>
-

translate('Reset Password')?>

+

translate('Reset Password', 'csnuser')?>