summaryrefslogtreecommitdiff
path: root/templates/webmail
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis.hoffmann@rwth-aachen.de>2022-05-05 14:41:10 +0200
committerJannis M. Hoffmann <jannis.hoffmann@rwth-aachen.de>2022-05-05 14:41:10 +0200
commitfebfd792ce3a63314c980cc29440cf2f127953b4 (patch)
tree196b98d1ead81459869aa4675fd7a198b0d7822b /templates/webmail
parente740d60265adacfef6edb6b534ae31eedf9011da (diff)
propper cram support (baring some details rng)
Diffstat (limited to 'templates/webmail')
-rw-r--r--templates/webmail/login.html.ep26
-rw-r--r--templates/webmail/readmail.html.ep2
-rw-r--r--templates/webmail/writemail.html.ep3
3 files changed, 28 insertions, 3 deletions
diff --git a/templates/webmail/login.html.ep b/templates/webmail/login.html.ep
index 3e224a8..0b7b080 100644
--- a/templates/webmail/login.html.ep
+++ b/templates/webmail/login.html.ep
@@ -1,5 +1,7 @@
% layout 'mainlayout';
+% my $uses_cram = config->{session}{secure} eq 'cram';
+
<div id=login class="jwm-base">
<h1>
@@ -22,14 +24,36 @@
%= label_for password => ucfirst l 'passwd'
%= password_field 'password' => (required => '')
</div>
+% if ($uses_cram) {
+ %= hidden_field challenge => rand
+% }
<div class="pure-controls">
- %= submit_button l('login') => (class => 'pure-button pure-button-primary')
+ %= submit_button l('login') => (class => 'pure-button pure-button-primary') => (name => 'submit_button') => $uses_cram ? (disabled => '') : ()
</div>
</fieldset>
% end
</div>
+% if ($uses_cram) {
+<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"
+ integrity="sha512-E8QSvWZ0eCLGk4km3hxSsNmGWbLtSCSUcewDQPQWZF6pEU8GlT8a5fF32wOl1i8ftdMhssTrF/OhyGWwonTcXA=="
+ crossorigin="anonymous" referrerpolicy="no-referrer"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/hmac-md5.min.js"
+ integrity="sha512-gy8JaBxTrtIxNLe1FfMAXey61VjQk3Af4EyY/EpVfmWPH16iCgdRZMHEFgKIyxMrarlc6+rDf6WneGL4SWqnpg=="
+ crossorigin="anonymous" referrerpolicy="no-referrer"></script>
+
+<script>
+ document.login1.submit_button.disabled = false;
+
+ document.forms.login1.addEventListener("formdata", (form_data_evt) => {
+ const form_data = form_data_evt.formData;
+ const res = CryptoJS.HmacMD5(form_data.get("challenge"), form_data.get("password"))
+ form_data.set("password", res)
+ });
+</script>
+% }
+
%= javascript begin
if (!document.login1.userid.value) {
document.login1.userid.focus();
diff --git a/templates/webmail/readmail.html.ep b/templates/webmail/readmail.html.ep
index f39dd0e..5bad9f3 100644
--- a/templates/webmail/readmail.html.ep
+++ b/templates/webmail/readmail.html.ep
@@ -12,7 +12,7 @@
<h1>Read Mail</h1>
- <dl>
+ <dl class="jwm-mail-header">
<dt> <%= uc l 'subject' %> </dt>
<dd> <%= $msg->{head}{subject} %> </dd>
diff --git a/templates/webmail/writemail.html.ep b/templates/webmail/writemail.html.ep
index 6342927..9d148c1 100644
--- a/templates/webmail/writemail.html.ep
+++ b/templates/webmail/writemail.html.ep
@@ -27,7 +27,8 @@
%= email_field 'back_to'
%= label_for txt => ucfirst l 'content'
- %= text_area body => (cols => 80) => (rows => 24) => (name => 'txt')
+ %# text_area body => (cols => 80) => (rows => 24) => (name => 'txt')
+ %= text_area body => (style => 'width: 100%') => (rows => 24) => (name => 'txt')
%= label_for attach => ucfirst l 'attach file'
%= file_field 'attach'