-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d0155cf
commit 005e3ae
Showing
12 changed files
with
204 additions
and
2 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 @@ | ||
'CodeQ.PasswordProtectedContent:Mixin.Password': | ||
abstract: true | ||
ui: | ||
inspector: | ||
groups: | ||
passwordprotect: | ||
label: i18n | ||
icon: 'fas fa-lock' | ||
properties: | ||
passwordProtectedContentPassword: | ||
type: string | ||
defaultValue: '' | ||
ui: | ||
label: i18n | ||
icon: 'fas fa-lock' | ||
reloadPageIfChanged: true | ||
inspector: | ||
group: passwordprotect | ||
position: 100 |
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,11 @@ | ||
Neos: | ||
Neos: | ||
fusion: | ||
autoInclude: | ||
CodeQ.PasswordProtectedContent: true | ||
userInterface: | ||
translation: | ||
autoInclude: | ||
CodeQ.PasswordProtectedContent: | ||
- 'Fusion/*' | ||
- 'NodeTypes/*' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
prototype(CodeQ.PasswordProtectedContent:Component.PasswordForm) < prototype(Neos.Fusion:Component) { | ||
################################## | ||
# These settings are public API: # | ||
################################## | ||
formMessage = ${Translation.translate('formMessage', null, [], 'Fusion/Component/PasswordForm', 'CodeQ.PasswordProtectedContent')} | ||
wrongPasswordErrorMessage = ${Translation.translate('wrongPasswordError', null, [], 'Fusion/Component/PasswordForm', 'CodeQ.PasswordProtectedContent')} | ||
wrongPasswordStyles = 'color: red;' | ||
|
||
################################## | ||
# Property set by the processor: # | ||
################################## | ||
wrongPassword = false | ||
|
||
# rendering | ||
renderer = afx` | ||
<div class={'password-protected-content' + (props.wrongPasswordStyles ? ' password-protected-content--has-error' : '')}> | ||
<form class="password-protected-content__form" action="" method="POST"> | ||
<label class="password-protected-content__form-label" for="passwordProtectedContentPassword">{props.formMessage}</label> | ||
<input class="password-protected-content__form-input" id="passwordProtectedContentPassword" type="password" name="passwordProtectedContentPassword" /> | ||
<div class="password-protected-content__eror-message" id="passwordProtectedContentPasswordError" @if.has={props.wrongPassword} style={props.wrongPasswordStyles}> | ||
{props.wrongPasswordErrorMessage} | ||
<script>{" | ||
document.getElementById('passwordProtectedContentPassword').addEventListener('input', function() { | ||
/* as soon as the user types, remove the error message */ | ||
var el = document.getElementById('passwordProtectedContentPasswordError'); if(el) el.remove(); | ||
}, false); | ||
"}</script> | ||
</div> | ||
<input class="password-protected-content__form-submit" type="submit" value="Submit" /> | ||
</form> | ||
</div> | ||
` | ||
|
||
@cache { | ||
mode = 'embed' | ||
} | ||
} |
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,43 @@ | ||
prototype(CodeQ.PasswordProtectedContent:Helper.ProtectContent) < prototype(Neos.Fusion:Component) { | ||
################################## | ||
# These settings are public API: # | ||
################################## | ||
configuredPassword = ${q(node).property('passwordProtectedContentPassword')} | ||
renderContentInBackend = true | ||
passwordForm = CodeQ.PasswordProtectedContent:Component.PasswordForm | ||
|
||
|
||
# rendering | ||
@context { | ||
configuredPassword = ${this.configuredPassword} | ||
renderContentInBackend = ${this.renderContentInBackend} | ||
enteredPassword = ${request.arguments.passwordProtectedContentPassword || ''} | ||
content = ${value} | ||
} | ||
|
||
renderer = Neos.Fusion:Case { | ||
noPasswordConfigured { | ||
condition = ${String.length(configuredPassword) == 0} | ||
renderer = ${content} | ||
} | ||
backend { | ||
condition = ${renderContentInBackend && node.context.inBackend} | ||
renderer = afx` | ||
<Carbon.Notification:Tag type="info"> | ||
{Translation.translate('backend.configuredPasswordNotification', null, [configuredPassword], 'Fusion/Helper/ProtectContent', 'CodeQ.PasswordProtectedContent')} | ||
</Carbon.Notification:Tag> | ||
{content} | ||
` | ||
} | ||
noOrWrongPassword { | ||
condition = ${configuredPassword != enteredPassword} | ||
renderer = CodeQ.PasswordProtectedContent:Component.PasswordForm { | ||
wrongPassword = ${String.length(enteredPassword) > 0} | ||
} | ||
} | ||
validPassword { | ||
condition = true | ||
renderer = ${content} | ||
} | ||
} | ||
} |
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,9 @@ | ||
############################################## | ||
############################################## | ||
#### #### | ||
#### !!!DO NOT EDIT THIS FILE!!!! #### | ||
#### #### | ||
############################################## | ||
############################################## | ||
|
||
include: **/*.fusion |
15 changes: 15 additions & 0 deletions
15
Resources/Private/Translations/de/Fusion/Component/PasswordForm.xlf
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,15 @@ | ||
<?xml version="1.0"?> | ||
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> | ||
<file original="" product-name="CodeQ.PasswordProtectedContent" source-language="en" datatype="plaintext" target-language="de"> | ||
<body> | ||
<trans-unit id="formMessage" xml:space="preserve"> | ||
<source>This content is protected, please enter the password:</source> | ||
<target xml:lang="de" state="translated">Dieser Inhalt ist geschützt, bitte geben Sie das Passwort ein:</target> | ||
</trans-unit> | ||
<trans-unit id="wrongPasswordError" xml:space="preserve"> | ||
<source>This password is wrong.</source> | ||
<target xml:lang="de" state="translated">Dieses Passwort ist falsch.</target> | ||
</trans-unit> | ||
</body> | ||
</file> | ||
</xliff> |
11 changes: 11 additions & 0 deletions
11
Resources/Private/Translations/de/Fusion/Helper/ProtectContent.xlf
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,11 @@ | ||
<?xml version="1.0"?> | ||
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> | ||
<file original="" product-name="CodeQ.PasswordProtectedContent" source-language="en" datatype="plaintext" target-language="de"> | ||
<body> | ||
<trans-unit id="backend.configuredPasswordNotification" xml:space="preserve"> | ||
<source>This content is protected from visitors with the password "{0}". Please keep in mind, this is a weak protection and you should never protect sensitive information only with a password.</source> | ||
<target xml:lang="de" state="translated">Dieser Inhalt ist vor Besuchern durch das Passwort "{0}" geschützt. Bitte beachten Sie, dass dies ein schwacher Schutz ist und sensible Daten niemals nur mit einem Passwort geschützt werden sollten.</target> | ||
</trans-unit> | ||
</body> | ||
</file> | ||
</xliff> |
15 changes: 15 additions & 0 deletions
15
Resources/Private/Translations/de/NodeTypes/Mixin/Password.xlf
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,15 @@ | ||
<?xml version="1.0"?> | ||
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> | ||
<file original="" source-language="en" datatype="plaintext"> | ||
<body> | ||
<trans-unit id="groups.passwordprotect" xml:space="preserve"> | ||
<source>Password Protection</source> | ||
<target xml:lang="de" state="translated">Passwort-Schutz</target> | ||
</trans-unit> | ||
<trans-unit id="properties.passwordProtectedContentPassword" xml:space="preserve"> | ||
<source>Password (visible for all editors)</source> | ||
<target xml:lang="de" state="translated">Passwort (sichtbar für alle Editoren)</target> | ||
</trans-unit> | ||
</body> | ||
</file> | ||
</xliff> |
13 changes: 13 additions & 0 deletions
13
Resources/Private/Translations/en/Fusion/Component/PasswordForm.xlf
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,13 @@ | ||
<?xml version="1.0"?> | ||
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> | ||
<file original="" product-name="CodeQ.PasswordProtectedContent" source-language="en" datatype="plaintext"> | ||
<body> | ||
<trans-unit id="formMessage" xml:space="preserve"> | ||
<source>This content is protected, please enter the password:</source> | ||
</trans-unit> | ||
<trans-unit id="wrongPasswordError" xml:space="preserve"> | ||
<source>This password is wrong.</source> | ||
</trans-unit> | ||
</body> | ||
</file> | ||
</xliff> |
10 changes: 10 additions & 0 deletions
10
Resources/Private/Translations/en/Fusion/Helper/ProtectContent.xlf
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,10 @@ | ||
<?xml version="1.0"?> | ||
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> | ||
<file original="" product-name="CodeQ.PasswordProtectedContent" source-language="en" datatype="plaintext"> | ||
<body> | ||
<trans-unit id="backend.configuredPasswordNotification" xml:space="preserve"> | ||
<source>This content is protected from visitors with the password "{0}". Please keep in mind, this is a weak protection and you should never protect sensitive information only with a password.</source> | ||
</trans-unit> | ||
</body> | ||
</file> | ||
</xliff> |
13 changes: 13 additions & 0 deletions
13
Resources/Private/Translations/en/NodeTypes/Mixin/Password.xlf
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,13 @@ | ||
<?xml version="1.0"?> | ||
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> | ||
<file original="" source-language="en" datatype="plaintext"> | ||
<body> | ||
<trans-unit id="groups.passwordprotect" xml:space="preserve"> | ||
<source>Password Protection</source> | ||
</trans-unit> | ||
<trans-unit id="properties.passwordProtectedContentPassword" xml:space="preserve"> | ||
<source>Password (visible for all editors)</source> | ||
</trans-unit> | ||
</body> | ||
</file> | ||
</xliff> |