Skip to content

Commit

Permalink
FIX Do not show TOTPSecret until the member has been initially saved
Browse files Browse the repository at this point in the history
  • Loading branch information
robbieaverill committed Nov 5, 2018
1 parent bc3baa2 commit 0ca0af7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Extensions/MemberExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MemberExtension extends DataExtension
* @var array
*/
private static $db = [
'TOTPSecret' => 'Varchar(1024)'
'TOTPSecret' => 'Varchar(1024)',
];

/**
Expand All @@ -48,6 +48,10 @@ public function onBeforeWrite()
*/
public function updateCMSFields(FieldList $fields)
{
if (!$this->owner->exists()) {
$fields->removeByName('TOTPSecret');
}

if (strlen($this->owner->TOTPSecret)) {
$qrcodeURI = $this->GoogleAuthenticatorQRCode();
$fields->addFieldToTab('Root.Main', ToggleCompositeField::create(
Expand Down

0 comments on commit 0ca0af7

Please sign in to comment.