├── .gitignore ├── .gitmodules ├── LICENSE.txt ├── MagentoConnect ├── Diglin_Username-1.1.0.tgz ├── Diglin_Username-1.1.1.tgz ├── Diglin_Username-1.2.0.tgz ├── Diglin_Username-1.3.0.tgz ├── Diglin_Username-1.4.0.tgz ├── Diglin_Username-1.5.0.tgz ├── Diglin_Username-2.2.1.tgz ├── Diglin_Username-2.2.2.tgz ├── Diglin_Username.xml └── images │ ├── Username.jpg │ ├── Username.psd │ ├── billing.png │ ├── createaccount.png │ ├── login.png │ ├── login_checkout.png │ ├── myaccount.png │ └── user_edit_backend.png ├── README.md ├── composer.json ├── modman └── src └── app ├── code └── community │ └── Diglin │ └── Username │ ├── Block │ └── Adminhtml │ │ └── Config │ │ └── Source │ │ ├── Generate.php │ │ └── Hint.php │ ├── Helper │ └── Data.php │ ├── Model │ ├── Config │ │ ├── Share.php │ │ └── Source │ │ │ └── Inputvalidation.php │ ├── Customer.php │ ├── Entity │ │ ├── Customer.php │ │ └── Setup.php │ ├── Form.php │ ├── Generate │ │ └── Flag.php │ ├── Import │ │ └── Entity │ │ │ └── Customer.php │ └── Observer.php │ ├── controllers │ ├── AccountController.php │ └── Adminhtml │ │ └── Username │ │ └── SyncController.php │ ├── data │ └── username_setup │ │ └── data-install-2.0.0.php │ ├── etc │ ├── adminhtml.xml │ ├── config.xml │ ├── system.xml │ ├── uninstall.txt │ ├── wsdl.xml │ └── wsi.xml │ └── sql │ └── username_setup │ ├── install-2.0.0.php │ ├── mysql4-install-1.0.0.php │ ├── mysql4-upgrade-1.0.0-1.1.0.php │ ├── mysql4-upgrade-1.1.0-1.2.0.php │ ├── mysql4-upgrade-1.3.0-1.4.0.php │ ├── mysql4-upgrade-1.4.0-2.0.0.php │ ├── uninstall.php │ └── upgrade-2.2.0-2.2.1.php ├── design ├── adminhtml │ └── default │ │ └── default │ │ └── template │ │ └── username │ │ └── system │ │ └── config │ │ └── generate.phtml └── frontend │ └── base │ └── default │ ├── layout │ └── username.xml │ └── template │ └── username │ ├── checkout │ └── onepage │ │ ├── 13 │ │ └── billing.phtml │ │ ├── 17 │ │ └── billing.phtml │ │ ├── billing.phtml │ │ └── login.phtml │ ├── customer │ ├── account │ │ └── dashboard │ │ │ └── info.phtml │ └── form │ │ ├── 13 │ │ └── register.phtml │ │ ├── 17 │ │ └── register.phtml │ │ ├── edit.phtml │ │ ├── forgotpassword.phtml │ │ ├── login.phtml │ │ └── register.phtml │ └── persistent │ ├── checkout │ └── onepage │ │ ├── billing.phtml │ │ └── login.phtml │ └── customer │ └── form │ ├── login.phtml │ └── register.phtml ├── etc └── modules │ └── Diglin_Username.xml └── locale ├── de_DE └── Diglin_Username.csv ├── en_GB └── Diglin_Username.csv ├── en_US └── Diglin_Username.csv └── fr_FR └── Diglin_Username.csv /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "MageTrashApp"] 2 | path = MageTrashApp 3 | url = https://github.com/magento-hackathon/MageTrashApp 4 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diglin/Diglin_Username/667baef60f786c7711a36d8e058566f32ad14b19/LICENSE.txt -------------------------------------------------------------------------------- /MagentoConnect/Diglin_Username-1.1.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diglin/Diglin_Username/667baef60f786c7711a36d8e058566f32ad14b19/MagentoConnect/Diglin_Username-1.1.0.tgz -------------------------------------------------------------------------------- /MagentoConnect/Diglin_Username-1.1.1.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diglin/Diglin_Username/667baef60f786c7711a36d8e058566f32ad14b19/MagentoConnect/Diglin_Username-1.1.1.tgz -------------------------------------------------------------------------------- /MagentoConnect/Diglin_Username-1.2.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diglin/Diglin_Username/667baef60f786c7711a36d8e058566f32ad14b19/MagentoConnect/Diglin_Username-1.2.0.tgz -------------------------------------------------------------------------------- /MagentoConnect/Diglin_Username-1.3.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diglin/Diglin_Username/667baef60f786c7711a36d8e058566f32ad14b19/MagentoConnect/Diglin_Username-1.3.0.tgz -------------------------------------------------------------------------------- /MagentoConnect/Diglin_Username-1.4.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diglin/Diglin_Username/667baef60f786c7711a36d8e058566f32ad14b19/MagentoConnect/Diglin_Username-1.4.0.tgz -------------------------------------------------------------------------------- /MagentoConnect/Diglin_Username-1.5.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diglin/Diglin_Username/667baef60f786c7711a36d8e058566f32ad14b19/MagentoConnect/Diglin_Username-1.5.0.tgz -------------------------------------------------------------------------------- /MagentoConnect/Diglin_Username-2.2.1.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diglin/Diglin_Username/667baef60f786c7711a36d8e058566f32ad14b19/MagentoConnect/Diglin_Username-2.2.1.tgz -------------------------------------------------------------------------------- /MagentoConnect/Diglin_Username-2.2.2.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diglin/Diglin_Username/667baef60f786c7711a36d8e058566f32ad14b19/MagentoConnect/Diglin_Username-2.2.2.tgz -------------------------------------------------------------------------------- /MagentoConnect/Diglin_Username.xml: -------------------------------------------------------------------------------- 1 | <_> 2 | 8g6kBx67uMfaKToj 3 | Diglin_Username 4 | community 5 | 6 | 2 7 | 8 | Create and login to an account thanks to a username AND email address.&#xD; 9 | Allow to disable an account from backend. The user will be blocked if the option in the customer backend is set to no 10 | This module allows you to:&#xD; 11 | &#xD; 12 | - login with a username or email address. it can be done from frontend during checkout or getting access to the customer account&#xD; 13 | - Username can have letters, digits, '_-' but no other special characters&#xD; 14 | - Username length is from 6 until 30 characters possible&#xD; 15 | - save a username from frontend (register account or checkout process) or from backend by editing a customer account&#xD; 16 | - check that the username doesn't already exists&#xD; 17 | - deactivate temporary customer account from Customer Management page (bonus functionnality). The user will be blocked if the option in the customer backend is set to no.&#xD; 18 | - The default template override some customer and checkout views to adapt display for login pages, checkout process and account edition in frontend. If you have a customized template, please check the layout file username.xml and compare with your template to use or adapt to your situation.&#xD; 19 | &#xD; 20 | Compatible Magento version &gt;= 1.4.2 until 1.9.1 21 | OSL v3.0 22 | http://www.opensource.org/licenses/osl-3.0.php 23 | 2.2.2 24 | stable 25 | Version 2.2.2 26 | - Fix issue with input validation (any kind of input was possible) 27 | 28 | Version 2.0.* 29 | e694fcb Add custom input validation 30 | 85a0f51 Update translations 31 | 1ca6441 Update Copyright 32 | 799fc1b [FIX] prevent to save username when it's not allowed from configuration 33 | 55ab34e make the module compatible with MAgento 1.8, change copyright, move column logic for customer grid into observer 34 | 6c49218 Merge pull request #7 from gdhnz/master 35 | bad7445 Add permission "allow everything" to adminhtml.xml to resolve admin 404 for the extension config screen under CE 1.8 36 | fa712c7 Code factoring 37 | 6c603d8 fix comment typo 38 | 5f5fe14 change to version 2.0.7 39 | 41e58bb fix bad condition test in case of not found $customerId in Form.php. Use case, checkout process with already logged in customer. 40 | b8e71c7 add submodule MageTrashApp 41 | 757a3e2 Update README.md 42 | 48244a4 add version 2.0.6 43 | e9453ff generate correctly username for old customers while installing the module 44 | f422067 Fix to the controller forgotPassword 45 | fd71c66 change version to 2.0.5 46 | 67bf362 cleanup some test 47 | adc2bb5 add fix when customer information are saved from backend, add observer fix for collection (do not know yet if it resolved hte problem of a user who contacted me about grid 48 | 1c0c07f change version number 49 | 4ab072f fix bad merging 50 | cd2bb86 Update README.md 51 | fa3f821 Update composer.json 52 | d10136e add dependency suggestion 53 | ff053ba remove todo task 54 | b300aa0 Fix a problem with sql data install with empty select query 55 | 5b179b5 add uninstall process for module MageTrashApp 56 | ce428e9 add composer.json 57 | d93cc55 merge observer 58 | 29d4c21 add condition to test if attribute username model exists before to save the config 59 | 14acf45 Update README.md 60 | 21f72b7 add missing column for sales_flat_order table 61 | 612052d improve checkout process as a guest (no complain that username is a required field when you are a guest), fix issue with install data script 62 | aafb0be split template depending on the magento version, add missing template for use cases using persisten customer feature 63 | ce9245b Fix or improve form model while saving new customer data 64 | 42444f3 Improve test if shop owner change the account sharing options 65 | 4d10edb Improve Username Module: setup is now completly rewritten for Magento 1.7, add username for forgotten password, allow now to disable the feature from configuration page, ch 66 | c6b7250 add customer ID fix depending on the context 67 | 788e656 add optionable strtolower username 68 | 49cb18d add optionable strtolower username 69 | dff09e0 Add modman and instruction to use it 70 | 2d6b6c8 Merge pull request #1 from clst/master 71 | 1d143e9 fix: weird quote characters in german language file 72 | 9cbf4a2 add: can now update is_active for existing customers 73 | dfa9cc6 Fix some bug and add a way to import is_active attribute 74 | 60c7143 Update README.md 75 | 24afad2 add gitignore and license files 76 | 77 | 78 | 79 | diglin 80 | 81 | 82 | diglin 83 | 84 | 85 | sly@diglin.com 86 | 87 | 88 | 5.2.9 89 | 6.0.0 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | Core 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | magelocal 123 | magecommunity 124 | mageetc 125 | magedesign 126 | magedesign 127 | magedesign 128 | magelocale 129 | magelocale 130 | magelocale 131 | magelocale 132 | 133 | 134 | 135 | Diglin/Username 136 | modules/Diglin_Username.xml 137 | adminhtml/default/default/template/username 138 | frontend/base/default/layout/username.xml 139 | frontend/base/default/template/username 140 | de_DE/Diglin_Username.csv 141 | en_GB/Diglin_Username.csv 142 | en_US/Diglin_Username.csv 143 | fr_FR/Diglin_Username.csv 144 | 145 | 146 | file 147 | dir 148 | file 149 | dir 150 | file 151 | dir 152 | file 153 | file 154 | file 155 | file 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | -------------------------------------------------------------------------------- /MagentoConnect/images/Username.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diglin/Diglin_Username/667baef60f786c7711a36d8e058566f32ad14b19/MagentoConnect/images/Username.jpg -------------------------------------------------------------------------------- /MagentoConnect/images/Username.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diglin/Diglin_Username/667baef60f786c7711a36d8e058566f32ad14b19/MagentoConnect/images/Username.psd -------------------------------------------------------------------------------- /MagentoConnect/images/billing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diglin/Diglin_Username/667baef60f786c7711a36d8e058566f32ad14b19/MagentoConnect/images/billing.png -------------------------------------------------------------------------------- /MagentoConnect/images/createaccount.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diglin/Diglin_Username/667baef60f786c7711a36d8e058566f32ad14b19/MagentoConnect/images/createaccount.png -------------------------------------------------------------------------------- /MagentoConnect/images/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diglin/Diglin_Username/667baef60f786c7711a36d8e058566f32ad14b19/MagentoConnect/images/login.png -------------------------------------------------------------------------------- /MagentoConnect/images/login_checkout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diglin/Diglin_Username/667baef60f786c7711a36d8e058566f32ad14b19/MagentoConnect/images/login_checkout.png -------------------------------------------------------------------------------- /MagentoConnect/images/myaccount.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diglin/Diglin_Username/667baef60f786c7711a36d8e058566f32ad14b19/MagentoConnect/images/myaccount.png -------------------------------------------------------------------------------- /MagentoConnect/images/user_edit_backend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diglin/Diglin_Username/667baef60f786c7711a36d8e058566f32ad14b19/MagentoConnect/images/user_edit_backend.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Diglin Username # 2 | 3 | Magento module which allows your customers to use a username and not only the email address as identifier 4 | 5 | ## Features 6 | 7 | - Compatible and tested with Magento version >=1.4.2 until 1.9.x (should work also on 1.3) 8 | - Login with a username and/or email, it can be done from frontend during checkout or getting access to the customer account 9 | - Save a username from frontend (register account or checkout process) or from backend by editing a customer account 10 | - Check that the username doesn't already exists 11 | - Allow you to deactivate temporary customer account from Customer Management page (bonus functionality from version > Magento 1.4.x). The user will be blocked if the option in the customer backend is set to no. 12 | - The default templates override some customer and checkout views to adapt display for login pages, checkout process and account edition in frontend. If you have a customized template, please check the layout file username.xml and compare with your template to use or adapt to your situation. 13 | - When you have already customers in your system and you do a first install of this plugin, a username may be generated for each customer based on a part of his email and a unique id. (e.g. email address is "developer@localhost.com" -> username is "developer1235467"). See the configuration page of the extension to trigger this feature 14 | - Configurable options to define what kind of username to support: only letters, only digits, both or default (digits, letters and special characters '-_') or even custom regex 15 | - Configurable options to set the maximum and minium string length 16 | - Display Username of each customer in the Customer Management Grid 17 | - Allow or not the customer to edit the username in My Account in frontend 18 | - Support username when a customer wants to retrieve his forgotten password thanks to the "Forgotten Password" form 19 | - Support username into the template of the persistent module 20 | - NEW - support Custom Regex validation (Select the Input validation 'custom' from the configuration page) 21 | 22 | ## Installation 23 | 24 | ### Via Magento Connect 25 | - You can install the current stable version via [MagentoConnect](http://www.magentocommerce.com/magento-connect/username-support-login-register-checkout-by-diglin.html) 26 | 27 | ### Via modman 28 | - Install [modman](https://github.com/colinmollenhour/modman) 29 | - Use the command from your Magento installation folder: `modman clone https://github.com/diglin/Diglin_Username.git` 30 | 31 | ### Via composer 32 | - Install [composer](http://getcomposer.org/download/) 33 | - Create a composer.json into your project like the following sample: 34 | 35 | ```json 36 | { 37 | ... 38 | "require": { 39 | "diglin/diglin_username":"*" 40 | }, 41 | "repositories": [ 42 | { 43 | "type": "composer", 44 | "url": "http://packages.firegento.com" 45 | } 46 | ], 47 | "extra":{ 48 | "magento-root-dir": "./" 49 | } 50 | } 51 | 52 | ``` 53 | 54 | - Then from your composer.json folder: `php composer.phar install` or `composer install` 55 | 56 | ### Manually 57 | - You can copy the files from the folders of this repository to the same folders of your installation 58 | 59 | ## Documentation 60 | 61 | - Please, configure the module go to the backend and follow the menu System > Configuration > Diglin > Username 62 | - You can put the username into your email template, you can put the following string {{var customer.username}} in the email templates: account_new.html and account_new_confirmation.html 63 | - If you have a 404 error page, try to login/logout and go back to the configuration page. Or save again the Administrator role in System > Permissions > Role 64 | 65 | ## Important 66 | 67 | - It's important to know if you create account from the backend, check which Website where you want to save the account 68 | - Check if you want to have the customer account global or per website, see in System > Configuration > Customers > Customer Configuration > Account Sharing Options 69 | If set to "Per website", the username will be unique per each website 70 | If set to "Global", the username will be unique for the whole website 71 | 72 | ## Uninstall 73 | 74 | The module install some data and changes in your database. Deinstalling the module will make some trouble cause of those data. You will need to remove those information by following the procedure below. 75 | 76 | #### Via MageTrashApp 77 | 78 | An additional module called MageTrashApp has been installed with this module to help you to uninstall this module in a clean way. If it is not installed, please install it from [MageTrashApp](https://github.com/magento-hackathon/MageTrashApp) 79 | If it is installed, go to your backend menu System > Configuration > Advanced > MageTrashApp, then click on the tab "Extension Installed", select the drop down option "Uninstall" of the module Diglin_Username and press "Save Config" button to uninstall 80 | If you use this module, you don't need to make any queries in your database as explained below in case of manually uninstallation. 81 | 82 | #### Via Magento Connect or manually 83 | 84 | - If you used Magento Connect, you may use the deinstall process of the Magento Connect Backend page view of your Magento installation. 85 | - Otherwise remove the files following the hierarchy of the folders of this repository 86 | - Then get access to your database and do the followings queries: 87 | Do the following sql query in your database after to have done a backup, please check the table name with your database: 88 | 89 | `DELETE FROM eav_attribute WHERE attribute_code LIKE '%username%';` 90 | `ALTER TABLE sales_flat_quote DROP COLUMN 'customer_username';` 91 | `ALTER TABLE sales_flat_order DROP COLUMN 'customer_username';` 92 | 93 | ## Author 94 | 95 | * Sylvain Rayé 96 | * http://www.diglin.com/ 97 | * [@diglin_](https://twitter.com/diglin_) 98 | * [Follow me on github!](https://github.com/diglin) 99 | 100 | ## Change Log 101 | - 2.2.1 102 | - Generate missing username from configuration backend thanks to a button instead while installing the extension 103 | - Allow username creation from order creation for a new customer 104 | - 2.2.0 105 | - Add Custom Input validation option 106 | - 2.1.0 107 | - Magento 1.8 support 108 | - Copyright changes 109 | - Move column grid to observer 110 | - 2.0.1 111 | - add composer support 112 | - fix some sql bugs while installing 113 | - 2.0: 114 | - add support for the "forgot password" form 115 | - fix bugs with checkout as guest 116 | - implement best practices for install process 117 | - check if same username are not used in different websites when the shop owner change the configuration of the "Account Sharing Options" 118 | - add conditional templates for the persistent module 119 | - Update the license in PHP file 120 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"diglin/diglin_username", 3 | "type":"magento-module", 4 | "license":"OSL-3.0", 5 | "homepage":"https://github.com/diglin/Diglin_Username", 6 | "description":"Support username login and account register in Magento instead of only email address.", 7 | "authors":[ 8 | { 9 | "name":"Sylvain Rayé", 10 | "email":"{firstname}.{lastname}@diglin.com" 11 | } 12 | ], 13 | "require":{ 14 | "magento-hackathon/magento-composer-installer":"*", 15 | "magento-hackathon/hackathon_magetrashapp":"*" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /modman: -------------------------------------------------------------------------------- 1 | @import MageTrashApp 2 | src/app/code/community/Diglin/Username app/code/community/Diglin/Username 3 | src/app/design/adminhtml/default/default/template/username app/design/adminhtml/default/default/template/username 4 | src/app/design/frontend/base/default/layout/username.xml app/design/frontend/base/default/layout/username.xml 5 | src/app/design/frontend/base/default/template/username app/design/frontend/base/default/template/username 6 | src/app/etc/modules/Diglin_Username.xml app/etc/modules/Diglin_Username.xml 7 | src/app/locale/de_DE/Diglin_Username.csv app/locale/de_DE/Diglin_Username.csv 8 | src/app/locale/en_GB/Diglin_Username.csv app/locale/en_GB/Diglin_Username.csv 9 | src/app/locale/en_US/Diglin_Username.csv app/locale/en_US/Diglin_Username.csv 10 | src/app/locale/fr_FR/Diglin_Username.csv app/locale/fr_FR/Diglin_Username.csv 11 | -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/Block/Adminhtml/Config/Source/Generate.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Copyright (c) 2008-2015 Diglin GmbH - Switzerland (http://www.diglin.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | */ 11 | 12 | /** 13 | * Class Diglin_Username_Block_Adminhtml_Config_Source_Generate 14 | */ 15 | class Diglin_Username_Block_Adminhtml_Config_Source_Generate extends Mage_Adminhtml_Block_System_Config_Form_Field 16 | { 17 | /* 18 | * Set template 19 | */ 20 | protected function _construct() 21 | { 22 | parent::_construct(); 23 | $this->setTemplate('username/system/config/generate.phtml'); 24 | } 25 | 26 | /** 27 | * Remove scope label 28 | * 29 | * @param Varien_Data_Form_Element_Abstract $element 30 | * @return string 31 | */ 32 | public function render(Varien_Data_Form_Element_Abstract $element) 33 | { 34 | $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue(); 35 | return parent::render($element); 36 | } 37 | 38 | /** 39 | * Return element html 40 | * 41 | * @param Varien_Data_Form_Element_Abstract $element 42 | * @return string 43 | */ 44 | protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) 45 | { 46 | return $this->_toHtml(); 47 | } 48 | 49 | /** 50 | * Return ajax url for synchronize button 51 | * 52 | * @return string 53 | */ 54 | public function getAjaxSyncUrl() 55 | { 56 | return Mage::getSingleton('adminhtml/url')->getUrl('*/username_sync/generate'); 57 | } 58 | 59 | /** 60 | * Return ajax url for synchronize button 61 | * 62 | * @return string 63 | */ 64 | public function getAjaxStatusUpdateUrl() 65 | { 66 | return Mage::getSingleton('adminhtml/url')->getUrl('*/username_sync/syncstatus'); 67 | } 68 | 69 | /** 70 | * Generate generate button html 71 | * 72 | * @return string 73 | */ 74 | public function getButtonHtml() 75 | { 76 | $button = $this->getLayout()->createBlock('adminhtml/widget_button') 77 | ->setData(array( 78 | 'id' => 'generate_button', 79 | 'label' => $this->helper('username')->__('Generate'), 80 | 'onclick' => 'javascript:generate(); return false;' 81 | )); 82 | 83 | return $button->toHtml(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/Block/Adminhtml/Config/Source/Hint.php: -------------------------------------------------------------------------------- 1 | ' 31 | .'' 32 | .' Diglin GmbH | Rütistrasse 14, 8952 Schlieren - Switzerland | support@diglin.com

'; 33 | 34 | return $html . '

Diglin_Username Version: '. Mage::getConfig()->getModuleConfig('Diglin_Username')->version .' - Powered by Diglin GmbH

'; 35 | } 36 | } -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/Helper/Data.php: -------------------------------------------------------------------------------- 1 | isModuleEnabled('persistent') 25 | && Mage::helper('core')->isModuleOutputEnabled('persistent') 26 | && Mage::helper('persistent')->isEnabled(); 27 | } 28 | } -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/Model/Config/Share.php: -------------------------------------------------------------------------------- 1 | getValue(); 38 | if ($value == self::SHARE_GLOBAL) { 39 | if (Mage::getResourceSingleton('customer/customer')->findUsernameDuplicates()) { 40 | Mage::throwException( 41 | Mage::helper('username')->__('Cannot share customer accounts globally because some customer accounts with the same username exist on multiple websites and cannot be merged.') 42 | ); 43 | } 44 | } 45 | return $this; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/Model/Config/Source/Inputvalidation.php: -------------------------------------------------------------------------------- 1 | 'default', 'label'=> $helper->__('Default (letters, digits and _- characters)')), 27 | array('value'=>'alphanumeric', 'label'=> $helper->__('Letters and digits')), 28 | array('value'=>'alpha', 'label'=> $helper->__('Letters only')), 29 | array('value'=>'numeric', 'label'=> $helper->__('Digits only')), 30 | array('value'=>'custom', 'label'=> $helper->__('Custom (PCRE Regex)')), 31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/Model/Customer.php: -------------------------------------------------------------------------------- 1 | loadByEmail($login); 35 | } else if (Mage::getStoreConfigFlag('username/general/enabled')) { 36 | $this->loadByUsername($login); 37 | } 38 | 39 | if ($this->getConfirmation() && $this->isConfirmationRequired()) { 40 | throw Mage::exception('Mage_Core', Mage::helper('customer')->__('This account is not confirmed.'), 41 | self::EXCEPTION_EMAIL_NOT_CONFIRMED 42 | ); 43 | } 44 | if (!$this->validatePassword($password)) { 45 | throw Mage::exception('Mage_Core', Mage::helper('customer')->__('Invalid login or password.'), 46 | self::EXCEPTION_INVALID_EMAIL_OR_PASSWORD 47 | ); 48 | } 49 | Mage::dispatchEvent('customer_customer_authenticated', array( 50 | 'model' => $this, 51 | 'password' => $password, 52 | )); 53 | 54 | return true; 55 | } 56 | 57 | /** 58 | * Load customer by username 59 | * 60 | * @param string $customerUsername 61 | * @return Mage_Customer_Model_Customer 62 | */ 63 | public function loadByUsername($customerUsername) 64 | { 65 | $this->_getResource()->loadByUsername($this, $customerUsername); 66 | 67 | return $this; 68 | } 69 | 70 | /** 71 | * Test if username already exists 72 | * 73 | * @param string $username 74 | * @param int $websiteId 75 | * @return Diglin_Username_Model_Customer|boolean 76 | */ 77 | public function customerUsernameExists($username, $websiteId = null) 78 | { 79 | if (!is_null($websiteId)) { 80 | $this->setWebsiteId($websiteId); 81 | } 82 | 83 | $this->loadByUsername($username); 84 | if ($this->getId()) { 85 | return $this; 86 | } 87 | 88 | return false; 89 | } 90 | } -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/Model/Entity/Customer.php: -------------------------------------------------------------------------------- 1 | getSharingConfig()->isWebsiteScope()) { 27 | $websiteId = (int) $customer->getWebsiteId(); 28 | }else{ 29 | $websiteId = null; 30 | } 31 | 32 | $model = Mage::getModel('customer/customer'); 33 | $result = $model->customerUsernameExists($customer->getUsername(), $websiteId); 34 | if ($result && $result->getId() != $customer->getId()) { 35 | throw Mage::exception('Mage_Core', Mage::helper('username')->__("Username already exists")); 36 | } 37 | } 38 | 39 | return $this; 40 | } 41 | 42 | protected function _getDefaultAttributes() 43 | { 44 | $attributes = parent::_getDefaultAttributes(); 45 | array_push($attributes, 'is_active'); 46 | return $attributes; 47 | } 48 | 49 | /** 50 | * Load customer by username 51 | * 52 | * @param Mage_Customer_Model_Customer $customer 53 | * @param string $username 54 | * @return Mage_Customer_Model_Entity_Customer 55 | * @throws Mage_Core_Exception 56 | */ 57 | public function loadByUsername(Mage_Customer_Model_Customer $customer, $username) 58 | { 59 | if (!Mage::getStoreConfigFlag('username/general/case_sensitive')) { 60 | $filter = new Zend_Filter_StringToLower(array('encoding' => 'UTF-8')); 61 | $username = $filter->filter($username); 62 | } 63 | $select = $this->_getReadAdapter()->select() 64 | ->from($this->getEntityTable(), array($this->getEntityIdField())) 65 | ->joinNatural(array('cev' => $this->getTable('customer_entity_varchar'))) 66 | ->joinNatural(array('ea' => $this->getTable('eav/attribute'))) 67 | ->where('ea.attribute_code=\'username\' AND cev.value=?',$username); 68 | 69 | if ($customer->getSharingConfig()->isWebsiteScope()) { 70 | if (!$customer->hasData('website_id')) { 71 | Mage::throwException(Mage::helper('customer')->__('Customer website ID must be specified when using the website scope.')); 72 | } 73 | $select->where('website_id=?', (int)$customer->getWebsiteId()); 74 | } 75 | 76 | if ($id = $this->_getReadAdapter()->fetchOne($select, 'entity_id')) { 77 | $this->load($customer, $id); 78 | } 79 | else { 80 | $customer->setData(array()); 81 | } 82 | return $this; 83 | } 84 | 85 | /** 86 | * Check whether there are username duplicates of customers in global scope 87 | * 88 | * @return bool 89 | */ 90 | public function findUsernameDuplicates() 91 | { 92 | $adapter = $this->_getReadAdapter(); 93 | $select = $adapter->select() 94 | ->from(array('cev' => $this->getTable('customer_entity_varchar')), array('cnt' => 'COUNT(*)')) 95 | ->joinLeft(array('ea' => $this->getTable('eav/attribute')), 'ea.attribute_id = cev.attribute_id') 96 | ->where('ea.attribute_code=\'username\'') 97 | ->group('cev.value') 98 | ->order('cnt DESC') 99 | ->limit(1); 100 | 101 | $lookup = $adapter->fetchRow($select); 102 | if (empty($lookup)) { 103 | return false; 104 | } 105 | return $lookup['cnt'] > 1; 106 | } 107 | } -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/Model/Entity/Setup.php: -------------------------------------------------------------------------------- 1 | getAdditionalAttributes(parent::getDefaultEntities()); 25 | } 26 | 27 | /** 28 | * 29 | * To be used directly by install script or by setup class 30 | * 31 | * @param null $entities 32 | * @return array 33 | */ 34 | public function getAdditionalAttributes ($entities = null) 35 | { 36 | $newEntity = array( 37 | 'username' => array( 38 | 'type' => 'varchar', 39 | 'input' => 'text', 40 | 'user_defined' => true, 41 | 'label' => 'Username', 42 | 'visible' => true, 43 | 'required' => false, 44 | 'sort_order' => 44, 45 | 'position' => 44, 46 | 'adminhtml_customer' => 1, 47 | 'adminhtml_checkout' => 1, 48 | 'validate_rules' => serialize(array( 49 | 'max_text_length' => 30, 50 | 'min_text_length' => 6 51 | )), 52 | ), 53 | 'is_active' => array( 54 | 'group' => 'Account information', 55 | 'label' => 'Active', 56 | 'type' => 'static', 57 | 'input' => 'select', 58 | 'user_defined' => true, 59 | 'source' => 'eav/entity_attribute_source_boolean', 60 | 'required' => false, 61 | 'default' => true, 62 | 'visible' => true, 63 | 'visible_on_front' => false, 64 | 'sort_order' => 40, 65 | 'position' => 40, 66 | 'adminhtml_only' => 1 67 | ) 68 | ); 69 | 70 | // In this case we just need the array of the data and set manually the attribute 71 | if (is_null($entities)) { 72 | return $newEntity; 73 | } 74 | 75 | return $entities['customer']['attributes'] = array_merge($entities['customer']['attributes'], $newEntity); 76 | } 77 | } -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/Model/Form.php: -------------------------------------------------------------------------------- 1 | 'UTF-8')); 39 | $data['username'] = $filter->filter($data['username']); 40 | } 41 | return $data; 42 | } 43 | 44 | /** 45 | * Validate Data 46 | * 47 | * @param array $data Data 48 | * @return array|bool 49 | * @throws Mage_Core_Exception 50 | */ 51 | public function validateData(array $data) 52 | { 53 | $errors = parent::validateData($data); 54 | 55 | // Prevent to change/save the username if it is not allowed on the frontend to change the username 56 | if (!Mage::getStoreConfigFlag('username/general/frontend') && !Mage::app()->getStore()->isAdmin() && $errors !== true) { 57 | return $errors; 58 | } 59 | 60 | if (!empty($data['username'])) { 61 | $model = Mage::getModel('customer/customer'); 62 | 63 | $customerId = Mage::app()->getFrontController() 64 | ->getRequest() 65 | ->getParam('customer_id'); 66 | 67 | if (!$customerId) { 68 | $customerId = Mage::app()->getFrontController() 69 | ->getRequest() 70 | ->getParam('id'); 71 | } 72 | 73 | if (!$customerId && !Mage::app()->getStore()->isAdmin()) { 74 | $customerId = Mage::getSingleton('customer/session')->getCustomer()->getId(); 75 | } 76 | 77 | // Prevent possible errors 78 | if (empty($customerId) && $errors !== true) { 79 | return $errors; 80 | } 81 | 82 | if (isset($data['website_id']) && $data['website_id'] !== false) { 83 | $websiteId = $data['website_id']; 84 | } elseif ($customerId) { 85 | $customer = $model->load($customerId); 86 | $websiteId = $customer->getWebsiteId(); 87 | 88 | // don't make any test if the user has already a username 89 | if ($customer->getUsername() == $data['username']) { 90 | return $errors; 91 | } 92 | } else { 93 | $websiteId = Mage::app()->getWebsite()->getId(); 94 | } 95 | 96 | if (!is_array($errors)) { 97 | $errors = array(); 98 | } 99 | 100 | $isCheckoutAsGuest = Mage::getSingleton('checkout/type_onepage')->getCheckoutMethod(); 101 | if ($isCheckoutAsGuest != Mage_Checkout_Model_Type_Onepage::METHOD_GUEST && empty($data['username'])) { 102 | $message = Mage::helper('username')->__('Username is a required field.'); 103 | $errors = array_merge($errors, array($message)); 104 | } 105 | 106 | // Other rules are validated by the parent class because they are basic rules provided by Magento Core 107 | $inputValidation = Mage::getStoreConfig('username/general/input_validation'); 108 | $useInputValidation = ($inputValidation == 'default' || $inputValidation == 'custom') ? true : false; 109 | 110 | if ($useInputValidation) { 111 | $validate = '/^*$/'; 112 | switch ($inputValidation) { 113 | case 'default': 114 | $validate = '/^[\w-]*$/'; 115 | break; 116 | case 'custom': 117 | $validate = Mage::getStoreConfig('username/general/input_validation_custom'); 118 | break; 119 | } 120 | 121 | $validate = new Zend_Validate_Regex($validate); 122 | 123 | if (!$validate->isValid($data['username'])) { 124 | if ($inputValidation == 'custom') { 125 | $message = Mage::getStoreConfig('username/general/input_validation_custom_message'); 126 | } else { 127 | $message = Mage::helper('username')-> 128 | __('Username is invalid! Only letters, digits and \'_-\' values are accepted.'); 129 | } 130 | $errors = array_merge($errors, array($message)); 131 | } 132 | } 133 | 134 | $result = $model->customerUsernameExists($data['username'], $websiteId); 135 | if ($result && $result->getId() != $customerId) { 136 | $message = Mage::helper('username')->__('Username already exists'); 137 | $errors = array_merge($errors, array($message)); 138 | } 139 | } 140 | if (is_array($errors) && count($errors) == 0) { 141 | return true; 142 | } 143 | return $errors; 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/Model/Generate/Flag.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Copyright (c) 2008-2015 Diglin GmbH - Switzerland (http://www.diglin.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | */ 11 | 12 | /** 13 | * Class Diglin_Username_Model_Generate_Flag 14 | */ 15 | class Diglin_Username_Model_Generate_Flag extends Mage_Core_Model_Flag 16 | { 17 | /** 18 | * There was no generation 19 | */ 20 | const STATE_INACTIVE = 0; 21 | /** 22 | * Generation process is active 23 | */ 24 | const STATE_RUNNING = 1; 25 | /** 26 | * Generation is finished 27 | */ 28 | const STATE_FINISHED = 2; 29 | /** 30 | * Generation finished and notify message was formed 31 | */ 32 | const STATE_NOTIFIED = 3; 33 | 34 | /** 35 | * Flag time to life in seconds 36 | */ 37 | const FLAG_TTL = 300; 38 | 39 | /** 40 | * Generation flag code 41 | * 42 | * @var string 43 | */ 44 | protected $_flagCode = 'username_generate'; 45 | 46 | /** 47 | * Pass error to flag 48 | * 49 | * @param Exception $e 50 | * @return Diglin_Username_Model_Generate_Flag 51 | */ 52 | public function passError(Exception $e) 53 | { 54 | $data = $this->getFlagData(); 55 | if (!is_array($data)) { 56 | $data = array(); 57 | } 58 | $data['has_errors'] = true; 59 | $this->setFlagData($data); 60 | return $this; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/Model/Import/Entity/Customer.php: -------------------------------------------------------------------------------- 1 | getResource()->getEntityTable(); 35 | $nextEntityId = Mage::getResourceHelper('importexport')->getNextAutoincrement($table); 36 | $passId = $resource->getAttribute('password_hash')->getId(); 37 | $passTable = $resource->getAttribute('password_hash')->getBackend()->getTable(); 38 | 39 | while ($bunch = $this->_dataSourceModel->getNextBunch()) { 40 | $entityRowsIn = array(); 41 | $entityRowsUp = array(); 42 | $attributes = array(); 43 | 44 | $oldCustomersToLower = array_change_key_case($this->_oldCustomers, CASE_LOWER); 45 | 46 | foreach ($bunch as $rowNum => $rowData) { 47 | if (!$this->validateRow($rowData, $rowNum)) { 48 | continue; 49 | } 50 | if (self::SCOPE_DEFAULT == $this->getRowScope($rowData)) { 51 | // entity table data 52 | $entityRow = array( 53 | 'group_id' => empty($rowData['group_id']) ? self::DEFAULT_GROUP_ID : $rowData['group_id'], 54 | 'store_id' => empty($rowData[self::COL_STORE]) 55 | ? 0 : $this->_storeCodeToId[$rowData[self::COL_STORE]], 56 | 'created_at' => empty($rowData['created_at']) 57 | ? now() : gmstrftime($strftimeFormat, strtotime($rowData['created_at'])), 58 | 'updated_at' => now(), 59 | 'is_active' => empty($rowData['is_active']) ? 1 : $this->_attributes['is_active']['options'][$rowData['is_active']] 60 | ); 61 | $emailToLower = strtolower($rowData[self::COL_EMAIL]); 62 | if (isset($oldCustomersToLower[$emailToLower][$rowData[self::COL_WEBSITE]])) { // edit 63 | $entityId = $oldCustomersToLower[$emailToLower][$rowData[self::COL_WEBSITE]]; 64 | $entityRow['entity_id'] = $entityId; 65 | $entityRowsUp[] = $entityRow; 66 | } else { // create 67 | $entityId = $nextEntityId++; 68 | $entityRow['entity_id'] = $entityId; 69 | $entityRow['entity_type_id'] = $this->_entityTypeId; 70 | $entityRow['attribute_set_id'] = 0; 71 | $entityRow['website_id'] = $this->_websiteCodeToId[$rowData[self::COL_WEBSITE]]; 72 | $entityRow['email'] = $rowData[self::COL_EMAIL]; 73 | $entityRow['is_active'] = 1; 74 | $entityRowsIn[] = $entityRow; 75 | 76 | $this->_newCustomers[$rowData[self::COL_EMAIL]][$rowData[self::COL_WEBSITE]] = $entityId; 77 | } 78 | // attribute values 79 | foreach (array_intersect_key($rowData, $this->_attributes) as $attrCode => $value) { 80 | if (!$this->_attributes[$attrCode]['is_static'] && strlen($value)) { 81 | /** @var $attribute Mage_Customer_Model_Attribute */ 82 | $attribute = $resource->getAttribute($attrCode); 83 | $backModel = $attribute->getBackendModel(); 84 | $attrParams = $this->_attributes[$attrCode]; 85 | 86 | if ('select' == $attrParams['type']) { 87 | $value = $attrParams['options'][strtolower($value)]; 88 | } elseif ('datetime' == $attrParams['type']) { 89 | $value = gmstrftime($strftimeFormat, strtotime($value)); 90 | } elseif ($backModel) { 91 | $attribute->getBackend()->beforeSave($resource->setData($attrCode, $value)); 92 | $value = $resource->getData($attrCode); 93 | } 94 | $attributes[$attribute->getBackend()->getTable()][$entityId][$attrParams['id']] = $value; 95 | 96 | // restore 'backend_model' to avoid default setting 97 | $attribute->setBackendModel($backModel); 98 | } 99 | } 100 | // password change/set 101 | if (isset($rowData['password']) && strlen($rowData['password'])) { 102 | $attributes[$passTable][$entityId][$passId] = $resource->hashPassword($rowData['password']); 103 | } 104 | } 105 | } 106 | $this->_saveCustomerEntity($entityRowsIn, $entityRowsUp)->_saveCustomerAttributes($attributes); 107 | } 108 | return $this; 109 | } 110 | 111 | /** 112 | * Update and insert data in entity table. 113 | * 114 | * clst: make is_active updateable for existing customers 115 | * 116 | * @param array $entityRowsIn Row for insert 117 | * @param array $entityRowsUp Row for update 118 | * @return Mage_ImportExport_Model_Import_Entity_Customer 119 | */ 120 | protected function _saveCustomerEntity(array $entityRowsIn, array $entityRowsUp) 121 | { 122 | if ($entityRowsIn) { 123 | $this->_connection->insertMultiple($this->_entityTable, $entityRowsIn); 124 | } 125 | if ($entityRowsUp) { 126 | $this->_connection->insertOnDuplicate( 127 | $this->_entityTable, 128 | $entityRowsUp, 129 | array('group_id', 'store_id', 'updated_at', 'created_at', 'is_active') 130 | ); 131 | } 132 | return $this; 133 | } 134 | 135 | } -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/Model/Observer.php: -------------------------------------------------------------------------------- 1 | getEvent()->getModel(); 31 | // Add the inactive option 32 | if ($customer->getIsActive() != '1') { 33 | throw new Mage_Core_Exception(Mage::helper('customer')->__('This account is disabled.'), 0); 34 | } 35 | } 36 | 37 | /** 38 | * Add on the fly the username attribute to the customer collection 39 | * 40 | * Event: eav_collection_abstract_load_before 41 | * 42 | * @param Varien_Event_Observer $observer Observer 43 | */ 44 | public function addAttributeToCollection($observer) 45 | { 46 | /* @var $collection Mage_Eav_Model_Entity_Collection_Abstract */ 47 | $collection = $observer->getEvent()->getCollection(); 48 | $entity = $collection->getEntity(); 49 | if (!empty($entity) && $entity->getType() == 'customer') { 50 | $collection->addAttributeToSelect('username'); 51 | } 52 | 53 | } 54 | 55 | /** 56 | * Change the attribute of username after the configuration 57 | * has been changed 58 | * 59 | * Event: admin_system_config_changed_section_username 60 | * 61 | * @param Varien_Event_Observer $observer Observer 62 | */ 63 | public function changeEavAttribute(Varien_Event_Observer $observer) 64 | { 65 | $minLength = Mage::getStoreConfig('username/general/min_length'); 66 | $maxLength = Mage::getStoreConfig('username/general/max_length'); 67 | $inputValidation = Mage::getStoreConfig('username/general/input_validation'); 68 | 69 | if ($minLength > $maxLength) { 70 | Mage::throwException( 71 | Mage::helper('username')-> 72 | __('Sorry but you cannot set a minimum length value %s bigger than the maximum length value %s. Please, change the values.', 73 | $minLength, 74 | $maxLength) 75 | ); 76 | } 77 | 78 | /* @var $attributeUsernameModel Mage_Customer_Model_Attribute */ 79 | $attributeUsernameModel = Mage::getModel('customer/attribute')->loadByCode('customer', 'username'); 80 | if ($attributeUsernameModel->getId()) { 81 | $rules = $attributeUsernameModel->getValidateRules(); 82 | $rules['max_text_length'] = $maxLength; 83 | $rules['min_text_length'] = $minLength; 84 | 85 | if ($inputValidation != 'default' && $inputValidation != 'custom') { 86 | $rules['input_validation'] = $inputValidation; 87 | } else { 88 | $rules['input_validation'] = ''; 89 | } 90 | 91 | $attributeUsernameModel->setValidateRules($rules); 92 | $attributeUsernameModel->save(); 93 | } 94 | } 95 | 96 | /** 97 | * Event 98 | * - core_block_abstract_to_html_before 99 | * 100 | * @param Varien_Event_Observer $observer Observer 101 | */ 102 | public function addUsernameColumn(Varien_Event_Observer $observer) 103 | { 104 | if (!Mage::getStoreConfigFlag('username/general/grid')) { 105 | return; 106 | } 107 | 108 | $grid = $observer->getBlock(); 109 | 110 | /** 111 | * Mage_Adminhtml_Block_Customer_Grid 112 | */ 113 | if ($grid instanceof Mage_Adminhtml_Block_Customer_Grid) { 114 | $grid->addColumnAfter( 115 | 'username', 116 | array( 117 | 'header' => Mage::helper('username')->__('Username'), 118 | 'index' => 'username' 119 | ), 120 | 'email' 121 | ); 122 | } 123 | } 124 | } -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/controllers/AccountController.php: -------------------------------------------------------------------------------- 1 | getRequest()->getPost('email'); 30 | if ($email) { 31 | 32 | /** @var $customer Diglin_Username_Model_Customer */ 33 | $customer = Mage::getModel('customer/customer') 34 | ->setWebsiteId(Mage::app()->getStore()->getWebsiteId()) 35 | ->loadByUsername($email); 36 | 37 | if (!$customer->getId() && !Zend_Validate::is($email, 'EmailAddress')) { 38 | $this->_getSession()->setForgottenEmail($email); 39 | $this->_getSession()->addError($this->__('Invalid email address.')); 40 | $this->_redirect('*/*/forgotpassword'); 41 | return; 42 | } else if (!$customer->getId()) { 43 | // Load by Email if username not found and email seems to be valid 44 | $customer 45 | ->setWebsiteId(Mage::app()->getStore()->getWebsiteId()) 46 | ->loadByEmail($email); 47 | } 48 | 49 | if ($customer->getId()) { 50 | try { 51 | $newResetPasswordLinkToken = $this->_getHelper('customer')->generateResetPasswordLinkToken(); 52 | $customer->changeResetPasswordLinkToken($newResetPasswordLinkToken); 53 | $customer->sendPasswordResetConfirmationEmail(); 54 | } catch (Exception $exception) { 55 | $this->_getSession()->addError($exception->getMessage()); 56 | $this->_redirect('*/*/forgotpassword'); 57 | return; 58 | } 59 | } 60 | $this->_getSession() 61 | ->addSuccess( $this->_getHelper('customer') 62 | ->__('If there is an account associated with %s you will receive an email with a link to reset your password.', 63 | $this->_getHelper('customer')->escapeHtml($email))); 64 | $this->_redirect('*/*/'); 65 | return; 66 | } else { 67 | $this->_getSession()->addError(Mage::helper('username')->__('Please enter your email or username.')); 68 | $this->_redirect('*/*/forgotpassword'); 69 | return; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/controllers/Adminhtml/Username/SyncController.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Copyright (c) 2008-2015 Diglin GmbH - Switzerland (http://www.diglin.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | */ 11 | 12 | /** 13 | * Class Diglin_Username_Adminhtml_Username_SyncController 14 | */ 15 | class Diglin_Username_Adminhtml_Username_SyncController extends Mage_Adminhtml_Controller_Action 16 | { 17 | /** 18 | * Return acl synchronize singleton 19 | * 20 | * @return Diglin_Username_Model_Generate_Flag 21 | */ 22 | protected function getSyncFlag() 23 | { 24 | return Mage::getSingleton('username/generate_flag')->loadSelf(); 25 | } 26 | 27 | /** 28 | * @todo to finish to implement by using flag and using Ajax response 29 | */ 30 | public function generateAction() 31 | { 32 | session_write_close(); 33 | 34 | $flag = $this->getSyncFlag(); 35 | $flag 36 | ->setState(Diglin_Username_Model_Generate_Flag::STATE_RUNNING) 37 | ->save(); 38 | 39 | $flag->setFlagData(array()); 40 | 41 | try { 42 | /* @var $eavConfig Mage_Eav_Model_Config */ 43 | $usernameAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'username'); 44 | 45 | $resource = Mage::getSingleton('core/resource'); 46 | $readConnection = $resource->getConnection('core_read'); 47 | 48 | $select = $readConnection 49 | ->select() 50 | ->from($resource->getTableName('customer_entity_varchar'), 'entity_id') 51 | ->where('attribute_id = ?', $usernameAttribute->getId()) 52 | ->where('value IS NOT NULL'); 53 | 54 | $ids = $readConnection->fetchCol($select); 55 | 56 | $select = $readConnection 57 | ->select() 58 | ->from(array('c' => $resource->getTableName('customer_entity')), array('email', 'entity_id', 'entity_type_id')) 59 | ->group('c.entity_id'); 60 | 61 | if (!empty($ids)) { 62 | $select 63 | ->joinLeft(array('cev' => $resource->getTableName('customer_entity_varchar')), 'c.entity_id = cev.entity_id') 64 | ->where('cev.entity_id NOT IN (' . implode(',', $ids) . ')'); 65 | } 66 | 67 | // @todo - add support for Customer Website Share option (check that the username doesn't already exist in other websites) 68 | // @todo - add support for username depending on the username type supported in the configuration (only letters, digits, etc) 69 | 70 | // Create username for old customers to prevent problem when creating an order as a guest 71 | $customers = $readConnection->fetchAll($select); 72 | $totalItemsDone = 0; 73 | 74 | $flagData['total_items'] = count($customers); 75 | $flag->setFlagData($flagData) 76 | ->save(); 77 | 78 | foreach ($customers as $customer) { 79 | $customer['attribute_id'] = $usernameAttribute->getId(); 80 | $email = $customer['email']; 81 | $pos = strpos($email, '@'); 82 | $customer['value'] = substr($email, 0, $pos) . substr(uniqid(), 0, 5) . $customer['entity_id']; 83 | 84 | unset($customer['email']); 85 | unset($customer['value_id']); 86 | 87 | // I know - direct sql query here is not good but there is no DBA for replace query 88 | $readConnection->query('REPLACE INTO ' 89 | . $readConnection->getTableName('customer_entity_varchar') 90 | . ' SET entity_id = :entity_id, entity_type_id = :entity_type_id, attribute_id = :attribute_id, value = :value', 91 | $customer); 92 | 93 | $flagData['total_items_done'] = $totalItemsDone; 94 | $flag->setFlagData($flagData) 95 | ->save(); 96 | } 97 | 98 | } catch (Exception $e) { 99 | Mage::logException($e); 100 | $flag->setHasErrors(true); 101 | } 102 | $flag->setState(Diglin_Username_Model_Generate_Flag::STATE_FINISHED)->save(); 103 | } 104 | 105 | /** 106 | * Get status of the sync 107 | */ 108 | public function syncstatusAction() 109 | { 110 | $flag = $this->getSyncFlag(); 111 | if ($flag) { 112 | $state = $flag->getState(); 113 | $flagData = $flag->getFlagData(); 114 | 115 | switch ($state) { 116 | case Diglin_Username_Model_Generate_Flag::STATE_RUNNING: 117 | if ($flagData['total_items'] > 0) { 118 | $percent = (int)($flagData['total_items_done'] * 100 / $flagData['total_items']) . '%'; 119 | $result['message'] = Mage::helper('username')->__('Generating username: %s done.', $percent); 120 | } else { 121 | $result ['message'] = Mage::helper('username')->__('Generating...'); 122 | } 123 | break; 124 | case Diglin_Username_Model_Generate_Flag::STATE_FINISHED: 125 | Mage::dispatchEvent('add_username_generate_message'); 126 | $result ['message'] = Mage::helper('username')->__('Generation finished'); 127 | 128 | if ($flag->getHasErrors()) { 129 | $result ['message'] .= Mage::helper('username')->__('Errors occurred while running. Please, check the log if enabled.'); 130 | $result ['has_errors'] = true; 131 | } 132 | $state = Diglin_Username_Model_Generate_Flag::STATE_NOTIFIED; 133 | break; 134 | case Diglin_Username_Model_Generate_Flag::STATE_NOTIFIED: 135 | break; 136 | default: 137 | $state = Diglin_Username_Model_Generate_Flag::STATE_INACTIVE; 138 | break; 139 | } 140 | } else { 141 | $state = Diglin_Username_Model_Generate_Flag::STATE_INACTIVE; 142 | } 143 | $result['state'] = $state; 144 | 145 | $result = Mage::helper('core')->jsonEncode($result); 146 | Mage::app()->getResponse()->setBody($result); 147 | } 148 | } -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/data/username_setup/data-install-2.0.0.php: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | 16 | 17 | Allow Everything 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | Username Section 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/etc/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 2.2.3 23 | 24 | 25 | 26 | 27 | 28 | 1 29 | 0 30 | 1 31 | 30 32 | 6 33 | default 34 | 1 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 11customer_usernamecustomer_username 43 | 44 | 45 | * 46 | 47 | 48 | username 49 | 50 | 51 | * 52 | 53 | 54 | ** 55 | 56 | 57 | * 58 | 59 | 60 | 61 | 62 | 63 | Diglin_Username_Helper 64 | 65 | 66 | 67 | 68 | 69 | Diglin_Username_Block 70 | 71 | 72 | 73 | 74 | Diglin_Username_Model 75 | 76 | 77 | 78 | Diglin_Username_Model_Customer 79 |
Diglin_Username_Model_Form
80 | Diglin_Username_Model_Setup 81 | Diglin_Username_Model_Config_Share 82 |
83 |
84 | 85 | 86 | Diglin_Username_Model_Entity_Customer 87 | 88 | 89 | 90 | 91 | Diglin_Username_Model_Entity_Customer 92 | 93 | 94 | 95 | 96 | Diglin_Username_Model_Import_Entity_Customer 97 | 98 | 99 |
100 | 101 | 102 | 103 | 104 | Diglin_Username 105 | Diglin_Username_Model_Entity_Setup 106 | 107 | 108 | default_setup 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | singleton 118 | username/observer 119 | isActive 120 | 121 | 122 | 123 | 124 |
125 | 126 | 127 | 128 | 129 | 130 | 131 | Diglin_Username 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | Diglin_Username.csv 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | username.xml 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | username/observer 161 | changeEavAttribute 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | username/observer 170 | addAttributeToCollection 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | singleton 179 | username/observer 180 | addUsernameColumn 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | Diglin_Username_Adminhtml 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | uninstall.txt 201 | 202 |
203 | -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/etc/system.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | 16 | 17 | 400 18 | 19 | 20 | 21 | 22 | 23 | 24 | diglin 25 | text 26 | 120 27 | 1 28 | 1 29 | 1 30 | 31 | 32 | username/adminhtml_config_source_hint 33 | 0 34 | 1 35 | 1 36 | 1 37 | 38 | 39 | 40 | text 41 | 1 42 | 1 43 | 1 44 | 1 45 | 46 | 47 | 48 | select 49 | adminhtml/system_config_source_yesno 50 | 1 51 | 1 52 | 1 53 | 1 54 | 55 | 56 | 57 | 58 | select 59 | adminhtml/system_config_source_yesno 60 | 10 61 | 1 62 | 1 63 | 1 64 | 65 | 66 | 67 | 68 | select 69 | adminhtml/system_config_source_yesno 70 | 20 71 | 1 72 | 73 | 74 | 75 | 76 | text 77 | 30 78 | 1 79 | 80 | 81 | 82 | 83 | text 84 | 40 85 | 1 86 | 87 | 88 | 89 | 90 | select 91 | username/config_source_inputvalidation 92 | 50 93 | 1 94 | 95 | 96 | 97 | 98 | text 99 | 60 100 | 1 101 | /^[\w-]*$/. More info at PHP Manual]]> 102 | 103 | custom 104 | 105 | 106 | 107 | 108 | text 109 | 70 110 | 1 111 | ]]> 112 | 113 | custom 114 | 115 | 116 | 117 | 118 | select 119 | adminhtml/system_config_source_yesno 120 | 80 121 | 1 122 | 123 | 124 | 125 | 126 | 127 | button 128 | username/adminhtml_config_source_generate 129 | 90 130 | 1 131 | 0 132 | 0 133 | 134 | 135 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/etc/uninstall.txt: -------------------------------------------------------------------------------- 1 | app/code/community/Diglin/Username app/code/community/Diglin/Username 2 | app/design/adminhtml/default/default/template/username app/design/adminhtml/default/default/template/username 3 | app/design/frontend/base/default/layout/username.xml app/design/frontend/base/default/layout/username.xml 4 | app/design/frontend/base/default/template/username app/design/frontend/base/default/template/username 5 | app/etc/modules/Diglin_Username.xml app/etc/modules/Diglin_Username.xml 6 | app/locale/de_DE/Diglin_Username.csv app/locale/de_DE/Diglin_Username.csv 7 | app/locale/en_GB/Diglin_Username.csv app/locale/en_GB/Diglin_Username.csv 8 | app/locale/en_US/Diglin_Username.csv app/locale/en_US/Diglin_Username.csv 9 | app/locale/fr_FR/Diglin_Username.csv app/locale/fr_FR/Diglin_Username.csv -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/etc/wsdl.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/etc/wsi.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/sql/username_setup/install-2.0.0.php: -------------------------------------------------------------------------------- 1 | getStore(Mage_Core_Model_App::ADMIN_STORE_ID); 26 | 27 | $attributes = $installer->getAdditionalAttributes(); 28 | 29 | foreach ($attributes as $attributeCode => $data) { 30 | $installer->addAttribute('customer', $attributeCode, $data); 31 | 32 | $attribute = $eavConfig->getAttribute('customer', $attributeCode); 33 | $attribute->setWebsite( (($store->getWebsite()) ? $store->getWebsite() : 0)); 34 | 35 | if (false === ($attribute->getIsSystem() == 1 && $attribute->getIsVisible() == 0)) { 36 | $usedInForms = array( 37 | 'customer_account_create', 38 | 'customer_account_edit', 39 | 'checkout_register', 40 | ); 41 | if (!empty($data['adminhtml_only'])) { 42 | $usedInForms = array('adminhtml_customer'); 43 | } else { 44 | $usedInForms[] = 'adminhtml_customer'; 45 | } 46 | if (!empty($data['adminhtml_checkout'])) { 47 | $usedInForms[] = 'adminhtml_checkout'; 48 | } 49 | 50 | $attribute->setData('used_in_forms', $usedInForms); 51 | } 52 | $attribute->save(); 53 | } 54 | 55 | $installer->startSetup(); 56 | 57 | $installer->getConnection()->addColumn($installer->getTable('sales/quote'), 'customer_username', array( 58 | 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, 59 | 'length' => '255', 60 | 'nullable' => true, 61 | 'comment' => 'Customer Username' 62 | )); 63 | 64 | $installer->getConnection()->addColumn($installer->getTable('sales/order'), 'customer_username', array( 65 | 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, 66 | 'length' => '255', 67 | 'nullable' => true, 68 | 'comment' => 'Customer Username' 69 | )); 70 | 71 | $installer->endSetup(); -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/sql/username_setup/mysql4-install-1.0.0.php: -------------------------------------------------------------------------------- 1 | getStore(Mage_Core_Model_App::ADMIN_STORE_ID); 23 | 24 | /* @var $eavConfig Mage_Eav_Model_Config */ 25 | $eavConfig = Mage::getSingleton('eav/config'); 26 | 27 | $attribute = array( 28 | 'label' => 'Username', 29 | 'visible' => true, 30 | 'required' => true, 31 | 'type' => 'varchar', 32 | 'input' => 'text', 33 | 'sort_order' => 65, 34 | 'validate_rules' => array( 35 | 'max_text_length' => 30, 36 | 'min_text_length' => 1 37 | ), 38 | 'used_in_forms' => array('adminhtml_customer','adminhtml_checkout','customer_account_edit', 'customer_account_create', 'checkout_register'), 39 | ); 40 | 41 | $installer->addAttribute('customer','username', $attribute); 42 | 43 | $attributes = array('username' => $attribute); 44 | 45 | foreach ($attributes as $attributeCode => $data) { 46 | $attribute = $eavConfig->getAttribute('customer', $attributeCode); 47 | $attribute->setWebsite( (($store->getWebsite())?$store->getWebsite():0)); 48 | $attribute->addData($data); 49 | if (false === ($attribute->getIsSystem() == 1 && $attribute->getIsVisible() == 0)) { 50 | $usedInForms = array( 51 | 'customer_account_create', 52 | 'customer_account_edit', 53 | 'checkout_register', 54 | ); 55 | if (!empty($data['adminhtml_only'])) { 56 | $usedInForms = array('adminhtml_customer'); 57 | } else { 58 | $usedInForms[] = 'adminhtml_customer'; 59 | } 60 | if (!empty($data['adminhtml_checkout'])) { 61 | $usedInForms[] = 'adminhtml_checkout'; 62 | }else { 63 | $usedInForms[] = 'adminhtml_checkout'; 64 | } 65 | 66 | $attribute->setData('used_in_forms', $usedInForms); 67 | } 68 | $attribute->save(); 69 | } 70 | 71 | $installer->startSetup(); 72 | 73 | $result = $installer->getConnection()->raw_fetchRow("SHOW COLUMNS from {$this->getTable('sales_flat_quote')} like '%customer_username%'"); 74 | if(!is_array($result) || !in_array('customer_username', $result)){ 75 | $installer->run(" 76 | ALTER TABLE `{$this->getTable('sales_flat_quote')}` 77 | ADD `customer_username` VARCHAR( 255 ) NULL AFTER `customer_taxvat` 78 | "); 79 | } 80 | 81 | $installer->endSetup(); -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/sql/username_setup/mysql4-upgrade-1.0.0-1.1.0.php: -------------------------------------------------------------------------------- 1 | getAttribute('customer', 'username'); 25 | 26 | $installer->startSetup(); 27 | 28 | $result = $installer->getConnection()->raw_fetchRow("SHOW COLUMNS from {$this->getTable('sales_flat_order')} like '%customer_username%'"); 29 | if(!is_array($result) || !in_array('customer_username', $result)){ 30 | $installer->run(" 31 | ALTER TABLE `{$this->getTable('sales_flat_order')}` 32 | ADD `customer_username` VARCHAR( 255 ) NULL AFTER `customer_taxvat` 33 | "); 34 | // can be a fix for bug of this module in Magento > 1.5 35 | } 36 | 37 | 38 | $select = new Zend_Db_Select($installer->getConnection()); 39 | $select->from(array('c' => $this->getTable('customer_entity')), 'email') 40 | ->joinLeft(array('cev' => $this->getTable('customer_entity_varchar')), 'c.entity_id = cev.entity_id') 41 | ->where("cev.entity_id NOT IN (SELECT entity_id FROM `{$this->getTable('customer_entity_varchar')}` WHERE attribute_id = {$usernameAttribute->getId()})") 42 | ->group('c.entity_id'); 43 | 44 | // Create username for old customers to prevent problem when creating an order 45 | $customers = $installer->getConnection()->fetchAll($select); 46 | foreach ($customers as $customer){ 47 | $customer['attribute_id'] = $usernameAttribute->getId(); 48 | $email = $customer['email']; 49 | $pos = strpos($email, '@'); 50 | $customer['value'] = substr($email, 0, $pos) . substr(uniqid(), 0, 5); 51 | unset($customer['email']); 52 | unset($customer['value_id']); 53 | 54 | $installer->getConnection()->insert($this->getTable('customer_entity_varchar'), $customer); 55 | } 56 | 57 | $installer->endSetup(); -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/sql/username_setup/mysql4-upgrade-1.1.0-1.2.0.php: -------------------------------------------------------------------------------- 1 | updateAttribute('customer', 'username', 'validate_rules', serialize(array('max_text_length' => 30, 'min_text_length' => 6))); 22 | //$installer->updateAttribute('customer', 'username', 'used_in_forms', serialize( array('customer_address_edit'))); // For onepage ! 23 | -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/sql/username_setup/mysql4-upgrade-1.3.0-1.4.0.php: -------------------------------------------------------------------------------- 1 | startSetup(); 23 | 24 | $entityTypeId = $installer->getEntityTypeId('customer'); 25 | $defaultAttributeSetId = $installer->getDefaultAttributeSetId($entityTypeId); 26 | 27 | $attribute = $installer->getAttribute($entityTypeId, 'is_active'); 28 | if($attribute) $installer->removeAttribute($entityTypeId, 'is_active'); 29 | 30 | $installer->addAttribute('customer', 'is_active', array( 31 | 'group' => 'Account information', 32 | 'label' => 'Active', 33 | 'type' => 'static', 34 | 'input' => 'select', 35 | 'user_defined' => true, 36 | 'source' => 'eav/entity_attribute_source_boolean', 37 | 'required' => false, 38 | 'default' => true, 39 | 'visible' => true, 40 | 'visible_on_front' => false, 41 | ) 42 | ); 43 | 44 | Mage::getSingleton('eav/config') 45 | ->getAttribute('customer', 'is_active') 46 | ->setData('used_in_forms', array('adminhtml_customer')) 47 | ->save(); 48 | 49 | $installer->endSetup(); -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/sql/username_setup/mysql4-upgrade-1.4.0-2.0.0.php: -------------------------------------------------------------------------------- 1 | updateAttribute('customer', 'username', 'is_required', 0); 24 | 25 | $installer->startSetup(); 26 | 27 | $select = $installer->getConnection()->select() 28 | ->from($installer->getTable('core_config_data'), 'config_id') 29 | ->where ('path = ?', 'username/general/force_tolower'); 30 | 31 | $ids = $installer->getConnection()->fetchCol($select); 32 | 33 | foreach ($ids as $id) { 34 | $installer->getConnection()->update($installer->getTable('core_config_data'), array('path' => 'username/general/case_sensitive'), array('config_id = ?' => $id)); 35 | } 36 | 37 | $installer->endSetup(); -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/sql/username_setup/uninstall.php: -------------------------------------------------------------------------------- 1 | deleteTableRow($installer->getTable('eav_attribute'), 'attribute_code', 'username'); 23 | $installer->getConnection()->dropColumn($installer->getTable('sales/quote'), 'customer_username'); 24 | $installer->getConnection()->dropColumn($installer->getTable('sales/order'), 'customer_username'); -------------------------------------------------------------------------------- /src/app/code/community/Diglin/Username/sql/username_setup/upgrade-2.2.0-2.2.1.php: -------------------------------------------------------------------------------- 1 | startSetup(); 23 | 24 | $installer->updateAttribute('customer', 'username', 'is_user_defined', 1); 25 | 26 | $installer->endSetup(); -------------------------------------------------------------------------------- /src/app/design/adminhtml/default/default/template/username/system/config/generate.phtml: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Copyright (c) 2008-2015 Diglin GmbH - Switzerland (http://www.diglin.com) 9 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 10 | */ 11 | 12 | // @var $this Diglin_Username_Block_Adminhtml_Config_Source_Generate 13 | ?> 14 | 84 | 85 | getButtonHtml(); ?><?php echo $this->__('Generate') ?> 86 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/layout/username.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/username/checkout/onepage/13/billing.phtml: -------------------------------------------------------------------------------- 1 | 18 |
19 |
20 | 185 | canShip()): ?> 186 | 187 | 188 |
189 |

__('* Required Fields') ?>

190 | 191 | 194 |
195 |
196 |
197 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/username/checkout/onepage/billing.phtml: -------------------------------------------------------------------------------- 1 | 18 | 19 | getChildHtml('checkout.onepage.login.extra')?> 20 |
21 | getChildHtml('login_before')?> 22 |
23 |

getQuote()->isAllowedGuestCheckout() ): ?>__('Checkout as a Guest or Register') ?>__('Register to Create an Account') ?>

24 | getQuote()->isAllowedGuestCheckout() ): ?> 25 |

__('Register with us for future convenience:') ?>

26 | 27 |

__('Register and save time!') ?>
28 | __('Register with us for future convenience:') ?>

29 | 33 | 34 | getQuote()->isAllowedGuestCheckout() ): ?> 35 | 45 |

__('Register and save time!') ?>

46 |

__('Register with us for future convenience:') ?>

47 | 51 | 52 | 53 | 54 |
55 |
56 |

__('Login') ?>

57 | getMessagesBlock()->toHtml() ?> 58 |
59 |
60 | getBlockHtml('formkey'); ?> 61 |

__('Already registered?') ?>

62 |

__('Please log in below:') ?>

63 |
    64 |
  • 65 | 66 |
    67 | 68 |
    69 |
  • 70 |
  • 71 | 72 |
    73 | 74 |
    75 |
  • 76 | getChildHtml('form.additional.info'); ?> 77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |

 

86 | 87 |
88 |
89 |
90 |
91 |

__('* Required Fields') ?>

92 | __('Forgot your password?') ?> 93 | 94 |
95 |
96 |
97 | 125 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/username/customer/account/dashboard/info.phtml: -------------------------------------------------------------------------------- 1 | getCustomer(); 19 | ?> 20 | getUsername()):?> 21 |
22 |
23 |

__('Additional Information') ?>

24 |
25 |
26 |
27 |
28 |
29 |

__('Extra User Information') ?>

30 | __('Edit') ?> 31 |
32 |
33 |

34 | __('Username: ') . $this->escapeHtml($customer->getUsername()) ?> 35 |

36 |
37 |
38 |
39 |
40 |
41 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/username/customer/form/13/register.phtml: -------------------------------------------------------------------------------- 1 | 24 |
25 |
26 |

__('Create an Account') ?>

27 |
28 | getChildHtml('form_fields_before')?> 29 | getMessagesBlock()->getGroupedHtml() ?> 30 |
31 |
32 | 33 | 34 |

__('Personal Information') ?>

35 |
    36 |
  • 37 | getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->toHtml() ?> 38 |
  • 39 |
  • 40 |
    41 | 42 |
    43 | 44 |
    45 |
    46 |
    47 | 48 |
    49 | 50 |
    51 |
    52 |
  • 53 | isNewsletterEnabled()): ?> 54 |
  • 55 |
    56 | getFormData()->getIsSubscribed()): ?> checked="checked" class="checkbox" /> 57 |
    58 | 59 |
  • 60 | 61 | getLayout()->createBlock('customer/widget_dob') ?> 62 | isEnabled()): ?> 63 |
  • setDate($this->getFormData()->getDob())->toHtml() ?>
  • 64 | 65 | getLayout()->createBlock('customer/widget_taxvat') ?> 66 | isEnabled()): ?> 67 |
  • setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?>
  • 68 | 69 | getLayout()->createBlock('customer/widget_gender') ?> 70 | isEnabled()): ?> 71 |
  • setGender($this->getFormData()->getGender())->toHtml() ?>
  • 72 | 73 |
74 |
75 | getShowAddressFields()): ?> 76 |
77 | 78 |

__('Address Information') ?>

79 |
    80 |
  • 81 |
    82 | 83 |
    84 | 85 |
    86 |
    87 |
    88 | 89 |
    90 | 91 |
    92 |
    93 |
  • 94 |
  • 95 | 96 |
    97 | 98 |
    99 |
  • 100 | helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?> 101 |
  • 102 |
    103 | 104 |
    105 |
  • 106 | 107 |
  • 108 |
    109 | 110 |
    111 | 112 |
    113 |
    114 |
    115 | 116 |
    117 | 120 | 125 | 126 |
    127 |
    128 |
  • 129 |
  • 130 |
    131 | 132 |
    133 | 134 |
    135 |
    136 |
    137 | 138 |
    139 | getCountryHtmlSelect() ?> 140 |
    141 |
    142 |
  • 143 |
144 | 145 | 146 |
147 | 148 |
149 |

__('Login Information') ?>

150 |
    151 |
  • 152 |
    153 | 154 |
    155 | 156 |
    157 |
    158 |
    159 | 160 |
    161 | 162 |
    163 |
    164 |
  • 165 |
166 |
167 |
168 |

__('* Required Fields') ?>

169 | 170 | 171 |
172 |
173 | 181 |
-------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/username/customer/form/17/register.phtml: -------------------------------------------------------------------------------- 1 | 18 | 25 |
26 |
27 |

__('Create an Account') ?>

28 |
29 | getChildHtml('form_fields_before')?> 30 | getMessagesBlock()->toHtml() ?> 31 | 32 | getChildHtml('customer.form.register.extra')?> 33 |
34 |
35 | 36 | 37 | 38 |

__('Personal Information') ?>

39 |
    40 |
  • 41 | getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?> 42 |
  • 43 |
  • 44 |
    45 | 46 |
    47 | 48 |
    49 |
    50 | 51 |
    52 | 53 |
    54 | 55 |
    56 |
    57 |
  • 58 | isNewsletterEnabled()): ?> 59 |
  • 60 |
    61 | getFormData()->getIsSubscribed()): ?> checked="checked" class="checkbox" /> 62 |
    63 | 64 | 65 | getChildHtml('customer.form.register.newsletter')?> 66 |
  • 67 | 68 | getLayout()->createBlock('customer/widget_dob') ?> 69 | isEnabled()): ?> 70 |
  • setDate($this->getFormData()->getDob())->toHtml() ?>
  • 71 | 72 | getLayout()->createBlock('customer/widget_taxvat') ?> 73 | isEnabled()): ?> 74 |
  • setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?>
  • 75 | 76 | getLayout()->createBlock('customer/widget_gender') ?> 77 | isEnabled()): ?> 78 |
  • setGender($this->getFormData()->getGender())->toHtml() ?>
  • 79 | 80 |
81 |
82 | getShowAddressFields()): ?> 83 |
84 | 85 |

__('Address Information') ?>

86 |
    87 |
  • 88 |
    89 | 90 |
    91 | 92 |
    93 |
    94 |
    95 | 96 |
    97 | 98 |
    99 |
    100 |
  • 101 | helper('customer/address')->getAttributeValidationClass('street'); ?> 102 |
  • 103 | 104 |
    105 | 106 |
    107 |
  • 108 | 109 | helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?> 110 |
  • 111 |
    112 | 113 |
    114 |
  • 115 | 116 |
  • 117 |
    118 | 119 |
    120 | 121 |
    122 |
    123 |
    124 | 125 |
    126 | 129 | 134 | 135 |
    136 |
    137 |
  • 138 |
  • 139 |
    140 | 141 |
    142 | 143 |
    144 |
    145 |
    146 | 147 |
    148 | getCountryHtmlSelect() ?> 149 |
    150 |
    151 |
  • 152 |
153 | 154 | 155 |
156 | 157 |
158 |

__('Login Information') ?>

159 |
    160 |
  • 161 |
    162 | 163 |
    164 | 165 |
    166 |
    167 |
    168 | 169 |
    170 | 171 |
    172 |
    173 |
  • 174 | getChildHtml('form.additional.info'); ?> 175 |
176 |
177 |
178 |

__('* Required Fields') ?>

179 | 180 | 181 |
182 |
183 | 191 |
-------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/username/customer/form/edit.phtml: -------------------------------------------------------------------------------- 1 | 18 |
19 |

__('Edit Account Information') ?>

20 |
21 | getMessagesBlock()->toHtml() ?> 22 |
23 |
24 | getBlockHtml('formkey')?> 25 |

__('Account Information') ?>

26 | 65 |
66 | 93 |
94 |

__('* Required Fields') ?>

95 | 96 | 97 |
98 |
99 | 122 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/username/customer/form/forgotpassword.phtml: -------------------------------------------------------------------------------- 1 | 20 |
21 |

__('Forgot Your Password?') ?>

22 |
23 | getMessagesBlock()->toHtml() ?> 24 |
25 |
26 |

__('Retrieve your password here') ?>

27 |

__('Please enter your email address or username below. You will receive a link to reset your password.') ?>

28 | 37 |
38 |
39 |

__('* Required Fields') ?>

40 | 41 | 42 |
43 |
44 | 49 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/username/customer/form/login.phtml: -------------------------------------------------------------------------------- 1 | 18 | 25 |
26 |
27 |

__('Login or Create an Account') ?>

28 |
29 | getMessagesBlock()->toHtml() ?> 30 | 31 | getChildHtml('customer.form.login.extra')?> 32 |
33 | getBlockHtml('formkey'); ?> 34 |
35 |
36 |
37 |

__('New Customers') ?>

38 |

__('By creating an account with our store, you will be able to move through the checkout process faster, store multiple shipping addresses, view and track your orders in your account and more.') ?>

39 |
40 |
41 |
42 |
43 |

__('Registered Customers') ?>

44 |

__('If you have an account with us, please log in.') ?>

45 |
    46 |
  • 47 | 48 |
    49 | 50 |
    51 |
  • 52 |
  • 53 | 54 |
    55 | 56 |
    57 |
  • 58 | getChildHtml('form.additional.info'); ?> 59 |
60 |

__('* Required Fields') ?>

61 |
62 |
63 |
64 |
65 |
66 |
67 | 68 |
69 |
70 |
71 |
72 | __('Forgot Your Password?') ?> 73 | 74 |
75 |
76 |
77 |
78 | 83 |
84 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/username/customer/form/register.phtml: -------------------------------------------------------------------------------- 1 | = 1.7.0 22 | $version = '17'; 23 | } 24 | 25 | include_once dirname(__FILE__) . '/' . $version . '/register.phtml'; -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/username/persistent/checkout/onepage/login.phtml: -------------------------------------------------------------------------------- 1 | 18 | 26 |
27 | getChildHtml('login_before')?> 28 |
29 |

getQuote()->isAllowedGuestCheckout() ): ?>__('Checkout as a Guest or Register') ?>__('Register to Create an Account') ?>

30 | getQuote()->isAllowedGuestCheckout() ): ?> 31 |

__('Register with us for future convenience:') ?>

32 | 33 |

__('Register and save time!') ?>
34 | __('Register with us for future convenience:') ?>

35 | 39 | 40 | getQuote()->isAllowedGuestCheckout() ): ?> 41 | 51 |

__('Register and save time!') ?>

52 |

__('Register with us for future convenience:') ?>

53 | 57 | 58 | 59 | 60 |
61 |
62 |

__('Login') ?>

63 | getMessagesBlock()->toHtml() ?> 64 |
65 |
66 | getBlockHtml('formkey'); ?> 67 |

__('Already registered?') ?>

68 |

__('Please log in below:') ?>

69 |
    70 |
  • 71 | 72 |
    73 | 74 |
    75 |
  • 76 |
  • 77 | 78 |
    79 | 80 |
    81 |
  • 82 | getChildHtml('form.additional.info'); ?> 83 | getChildHtml('persistent.remember.me'); ?> 84 |
85 | 86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |

 

94 | getQuote()->isAllowedGuestCheckout()): ?> 95 | 96 | helper('checkout')->isCustomerMustBeLogged()): ?> 97 | 98 | 99 |
100 | 101 |
102 | 103 |
104 |
105 |
106 |
107 |

__('* Required Fields') ?>

108 | __('Forgot your password?') ?> 109 | 110 |
111 |
112 |
113 | 141 | getRequest()->getParam('register'); 143 | if ($registerParam || $registerParam === ''): 144 | ?> 145 | 155 | 156 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/username/persistent/customer/form/login.phtml: -------------------------------------------------------------------------------- 1 | 18 | 26 |
27 |
28 |

__('Login or Create an Account') ?>

29 |
30 | getMessagesBlock()->getGroupedHtml() ?> 31 |
32 | getBlockHtml('formkey'); ?> 33 |
34 |
35 |
36 |

__('New Customers') ?>

37 |

__('By creating an account with our store, you will be able to move through the checkout process faster, store multiple shipping addresses, view and track your orders in your account and more.') ?>

38 |
39 |
40 |
41 |
42 |

__('Registered Customers') ?>

43 |

__('If you have an account with us, please log in.') ?>

44 |
    45 |
  • 46 | 47 |
    48 | 49 |
    50 |
  • 51 |
  • 52 | 53 |
    54 | 55 |
    56 |
  • 57 | getChildHtml('form.additional.info'); ?> 58 | getChildHtml('persistent.remember.me'); ?> 59 |
60 | getChildHtml('persistent.remember.me.tooltip'); ?> 61 |

__('* Required Fields') ?>

62 |
63 |
64 |
65 |
66 |
67 |
68 | 69 |
70 |
71 |
72 |
73 | __('Forgot Your Password?') ?> 74 | 75 |
76 |
77 |
78 | isContextCheckout()): ?> 79 | 80 | 81 |
82 | 87 |
88 | -------------------------------------------------------------------------------- /src/app/design/frontend/base/default/template/username/persistent/customer/form/register.phtml: -------------------------------------------------------------------------------- 1 | 18 | 26 |
27 |
28 |

__('Create an Account') ?>

29 |
30 | getChildHtml('form_fields_before')?> 31 | getMessagesBlock()->toHtml() ?> 32 |
33 |
34 | 35 | 36 | 37 |

__('Personal Information') ?>

38 |
    39 |
  • 40 | getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?> 41 |
  • 42 |
  • 43 |
    44 | 45 |
    46 | 47 |
    48 |
    49 | 50 |
    51 | 52 |
    53 | 54 |
    55 |
    56 |
  • 57 | isNewsletterEnabled()): ?> 58 |
  • 59 |
    60 | getFormData()->getIsSubscribed()): ?> checked="checked" class="checkbox" /> 61 |
    62 | 63 |
  • 64 | 65 | getLayout()->createBlock('customer/widget_dob') ?> 66 | isEnabled()): ?> 67 |
  • setDate($this->getFormData()->getDob())->toHtml() ?>
  • 68 | 69 | getLayout()->createBlock('customer/widget_taxvat') ?> 70 | isEnabled()): ?> 71 |
  • setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?>
  • 72 | 73 | getLayout()->createBlock('customer/widget_gender') ?> 74 | isEnabled()): ?> 75 |
  • setGender($this->getFormData()->getGender())->toHtml() ?>
  • 76 | 77 |
78 |
79 | getShowAddressFields()): ?> 80 |
81 | 82 |

__('Address Information') ?>

83 |
    84 |
  • 85 |
    86 | 87 |
    88 | 89 |
    90 |
    91 |
    92 | 93 |
    94 | 95 |
    96 |
    97 |
  • 98 | helper('customer/address')->getAttributeValidationClass('street'); ?> 99 |
  • 100 | 101 |
    102 | 103 |
    104 |
  • 105 | 106 | helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?> 107 |
  • 108 |
    109 | 110 |
    111 |
  • 112 | 113 |
  • 114 |
    115 | 116 |
    117 | 118 |
    119 |
    120 |
    121 | 122 |
    123 | 126 | 131 | 132 |
    133 |
    134 |
  • 135 |
  • 136 |
    137 | 138 |
    139 | 140 |
    141 |
    142 |
    143 | 144 |
    145 | getCountryHtmlSelect() ?> 146 |
    147 |
    148 |
  • 149 |
150 | 151 | 152 |
153 | 154 |
155 |

__('Login Information') ?>

156 |
    157 |
  • 158 |
    159 | 160 |
    161 | 162 |
    163 |
    164 |
    165 | 166 |
    167 | 168 |
    169 |
    170 |
  • 171 | getChildHtml('form.additional.info'); ?> 172 | getChildHtml('persistent.remember.me'); ?> 173 |
174 | getChildHtml('persistent.remember.me.tooltip'); ?> 175 |
176 |
177 |

__('* Required Fields') ?>

178 | 179 | 180 |
181 | isContextCheckout()): ?> 182 | 183 | 184 |
185 | 193 |
194 | -------------------------------------------------------------------------------- /src/app/etc/modules/Diglin_Username.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | community 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/app/locale/de_DE/Diglin_Username.csv: -------------------------------------------------------------------------------- 1 | "This account is disabled.","Dieses Benutzerkonto ist deaktiviert." 2 | "Username","Benutzername" 3 | "Email Address/Username","E-Mail-Adresse/Benutzername" 4 | "Email/Username:","E-Mail-Adresse/Benutzername:" -------------------------------------------------------------------------------- /src/app/locale/en_GB/Diglin_Username.csv: -------------------------------------------------------------------------------- 1 | "This account is disabled.","This account is disabled." 2 | "Username","Username" 3 | "Email Address/Username", "Email Address/Username" 4 | "'Email/Username:'","'Email/Username:'" 5 | "Username already exists","Username already exists" -------------------------------------------------------------------------------- /src/app/locale/en_US/Diglin_Username.csv: -------------------------------------------------------------------------------- 1 | "This account is disabled.","This account is disabled." 2 | "Username","Username" 3 | "Email Address/Username", "Email Address/Username" 4 | "'Email/Username:'","'Email/Username:'" 5 | "Username already exists","Username already exists" -------------------------------------------------------------------------------- /src/app/locale/fr_FR/Diglin_Username.csv: -------------------------------------------------------------------------------- 1 | "This account is disabled.","Ce compte est désactivé" 2 | "Username","Nom d'utilisateur" 3 | "Email Address/Username", "Adresse email / Nom d'utilisateur" 4 | "'Email/Username:'","'Adresse Email / Nom d\utilisateur:'" --------------------------------------------------------------------------------