V0.1
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
<h5 class="card-header">{% trans "Encryption testing" %}</h5>
|
||||
<div class="card-body d-flex flex-column">
|
||||
<p class="card-text">{% trans "The text will be automatically copied to your clipboard." %}</p>
|
||||
<textarea class="form-control m-2" cols="50" rows="4" v-model="text" @keyup="encrypt(text)"></textarea>
|
||||
<textarea class="form-control m-2" cols="50" rows="4" v-model="text" @keyup="encrypt_text(text)"></textarea>
|
||||
<p class="card-text text-danger" v-if="encryption_error">[[ encryption_error ]]</p>
|
||||
<textarea class="form-control m-2" cols="50" rows="4" v-model="encrypted" disabled></textarea>
|
||||
</div>
|
||||
</div>
|
||||
@@ -14,7 +15,8 @@
|
||||
<h5 class="card-header">{% trans "Decryption testing" %}</h5>
|
||||
<div class="card-body d-flex flex-column">
|
||||
<p class="card-text">{% trans "The text will be automatically copied to your clipboard." %}</p>
|
||||
<textarea class="form-control m-2" cols="50" rows="4" v-model="encrypted_text" @keyup="decrypt(encrypted_text)"></textarea>
|
||||
<textarea class="form-control m-2" cols="50" rows="4" v-model="encrypted_text" @keyup="decrypt_text(encrypted_text)"></textarea>
|
||||
<p class="card-text text-danger" v-if="decryption_error">[[ decryption_error ]]</p>
|
||||
<textarea class="form-control m-2" cols="50" rows="4" v-model="decrypted" disabled></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,34 +1,36 @@
|
||||
EncryptionTesting = {
|
||||
template: "#EncryptionTesting",
|
||||
props: ["crypto_key"],
|
||||
router_path: "/EncryptionTesting",
|
||||
delimiters: ["[[", "]]"],
|
||||
props: [],
|
||||
data: function() {
|
||||
return {
|
||||
text: '',
|
||||
encrypted: '',
|
||||
encrypted_text: '',
|
||||
decrypted: '',
|
||||
decryption_error: '',
|
||||
encryption_error: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
encrypt: function(data) {
|
||||
var self = this;
|
||||
|
||||
encryptWithKey(this.crypto_key, data).then(e => {
|
||||
self.encrypted = e;
|
||||
|
||||
navigator.clipboard.writeText(self.encrypted);
|
||||
})
|
||||
async encrypt_text (data) {
|
||||
try {
|
||||
this.encrypted = await this.encrypt(data)
|
||||
this.encryption_error = ""
|
||||
} catch (err) {
|
||||
this.encryption_error = "{{_('Error while encryption of message.') | escapejs}}"
|
||||
}
|
||||
},
|
||||
|
||||
decrypt: function(data) {
|
||||
var self = this;
|
||||
|
||||
decryptWithKey(this.crypto_key, data).then(e => {
|
||||
self.decrypted = e;
|
||||
|
||||
navigator.clipboard.writeText(self.encrypted);
|
||||
})
|
||||
async decrypt_text (data) {
|
||||
try {
|
||||
this.decrypted = await this.decrypt(data)
|
||||
this.decryption_error = ""
|
||||
} catch (err) {
|
||||
this.decryption_error = "{{_('Error while decryption of message.') | escapejs}}"
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user