-
-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3560 from forkcms/toggle-secret
Add ToggleSecret to backend scripts
- Loading branch information
Showing
6 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace ForkCMS\Core\Domain\Form; | ||
|
||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\Extension\Core\Type\PasswordType; | ||
|
||
final class TogglePasswordType extends AbstractType | ||
{ | ||
public function getParent(): string | ||
{ | ||
return PasswordType::class; | ||
} | ||
|
||
public function getBlockPrefix(): string | ||
{ | ||
return 'toggle_password'; | ||
} | ||
} |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export class TogglePasswordInputType { | ||
constructor (element) { | ||
this._button = element.querySelector('button') | ||
this._input = element.querySelector('input') | ||
|
||
this.init() | ||
} | ||
|
||
init () { | ||
this._button.addEventListener('click', () => { | ||
this.toggle() | ||
}) | ||
} | ||
|
||
toggle () { | ||
if (this._input.type === 'password') { | ||
this._input.type = 'text' | ||
this._button.innerHTML = '<i class="fa fa-eye ms-2"></i>' | ||
} else { | ||
this._input.type = 'password' | ||
this._button.innerHTML = '<i class="fa fa-eye-slash ms-2"></i>' | ||
} | ||
} | ||
} |
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters