Skip to content

Commit

Permalink
Fix Password field
Browse files Browse the repository at this point in the history
(all CMS .js is in a bundle, so this needed to be extracted)
  • Loading branch information
JorisDebonnet committed Feb 23, 2018
1 parent c0f62b6 commit acb4a36
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
14 changes: 14 additions & 0 deletions client/javascript/ConfirmedPasswordField.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* extracted from silverstripe/framework */

(function ($) {
$(document).on('click', '.confirmedpassword .showOnClick a', function () {
var $container = $('.showOnClickContainer', $(this).parent());

$container.toggle('fast', function() {
$container.find('input[type="hidden"]').val($container.is(":visible") ? 1 : 0);
});

return false;
})
.find(".confirmedpassword .showOnClickContainer").hide();
})(jQuery);
10 changes: 8 additions & 2 deletions src/Pages/MemberProfilePageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use SilverStripe\Control\Email\Email;
use SilverStripe\SiteConfig\SiteConfig;
use SilverStripe\Forms\LiteralField;
use SilverStripe\View\Requirements;
use Symbiote\MemberProfiles\Pages\MemberProfilePage;
use Symbiote\MemberProfiles\Pages\MemberProfileViewer;
use Symbiote\MemberProfiles\Email\MemberConfirmationEmail;
Expand Down Expand Up @@ -519,8 +520,13 @@ protected function getProfileFields($context) {
$field = $field->performReadonlyTransformation();
}

$field->setTitle($profileField->Title);
$field->setDescription($profileField->Note);
if($name == 'Password') {
Requirements::javascript("memberprofiles/client/javascript/ConfirmedPasswordField.js");
}

// The follow two if-conditions were added since the SS4 migration because a Password label disappeared
if($profileField->Title) $field->setTitle($profileField->Title);
if($profileField->Note) $field->setDescription($profileField->Note);

if($context == 'Registration' && $profileField->DefaultValue) {
$field->setValue($profileField->DefaultValue);
Expand Down

0 comments on commit acb4a36

Please sign in to comment.