Last active
April 16, 2020 15:57
-
-
Save engram-design/6dba6a0ec19ff38727d3 to your computer and use it in GitHub Desktop.
Revisions
-
engram-design revised this gist
Jul 17, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -46,8 +46,8 @@ public function init() $event->performAction = false; craft()->urlManager->setRouteVariables(array( 'account' => $user )); } }); } -
engram-design revised this gist
Jul 17, 2015 . 2 changed files with 19 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,11 +38,16 @@ public function init() $valid = true; if (!checkEmailIsAllowedDomain($email)) { $user->addError('email', Craft::t('Email supplied is not from allowed domain.')); $valid = false; } if (!$valid) { $event->performAction = false; craft()->urlManager->setRouteVariables(array( 'account' => $user )); } }); } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,21 @@ {% macro errorList(errors) %} {% if errors %} {% for error in errors %} <label class="error">{{ error }}</label> {% endfor %} {% endif %} {% endmacro %} {% from _self import errorList %} <form method="post" accept-charset="UTF-8"> {{ getCsrfInput() }} <input type="hidden" name="action" value="users/saveUser"> <input type="hidden" name="redirect" value=""> <input placeholder="Email" type="email" name="email" required="required"> {% if account is defined %} {{ errorList(account.getErrors('email')) }} {% endif %} </form> -
engram-design created this gist
Jul 17, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ <?php namespace Craft; class CustomUserDomainPlugin extends BasePlugin { /* -------------------------------------------------------------- * PLUGIN INFO * ------------------------------------------------------------ */ public function getName() { return Craft::t('Custom User Registration'); } public function getVersion() { return '1.0'; } public function getDeveloper() { return 'Josh Crawford'; } public function getDeveloperUrl() { return 'http://sgroup.com.au'; } public function init() { parent::init(); craft()->on('users.onBeforeSaveUser', function(Event $event) { $user = $event->params['user']; $email = craft()->request->getPost('email', $user->email); $valid = true; if (!checkEmailIsAllowedDomain($email)) { $valid = false; } if (!$valid) { $event->performAction = false; } }); } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ <form method="post" accept-charset="UTF-8"> {{ getCsrfInput() }} <input type="hidden" name="action" value="users/saveUser"> <input type="hidden" name="redirect" value=""> <input placeholder="Email" type="email" name="email" required="required"> </form>