summaryrefslogtreecommitdiffstats
path: root/content/passwordPrompt
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 06:29:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 06:29:37 +0000
commit9355e23a909a7801b3ccdf68ee05b3480be42407 (patch)
tree78220623341b88bd42d16929e2acb3e5ef52e0c8 /content/passwordPrompt
parentInitial commit. (diff)
downloadtbsync-9355e23a909a7801b3ccdf68ee05b3480be42407.tar.xz
tbsync-9355e23a909a7801b3ccdf68ee05b3480be42407.zip
Adding upstream version 4.7.upstream/4.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'content/passwordPrompt')
-rw-r--r--content/passwordPrompt/passwordPrompt.css13
-rw-r--r--content/passwordPrompt/passwordPrompt.js47
-rw-r--r--content/passwordPrompt/passwordPrompt.xhtml32
3 files changed, 92 insertions, 0 deletions
diff --git a/content/passwordPrompt/passwordPrompt.css b/content/passwordPrompt/passwordPrompt.css
new file mode 100644
index 0000000..4527ac3
--- /dev/null
+++ b/content/passwordPrompt/passwordPrompt.css
@@ -0,0 +1,13 @@
+ .grid-container {
+ display: grid;
+ grid-template-columns: auto 1fr;
+ grid-template-rows: auto auto auto;
+ gap: 1px;
+ width: 250px;
+ margin: 2ex auto;
+ }
+
+ .grid-item {
+ padding: 2px;
+ text-align: left;
+ }
diff --git a/content/passwordPrompt/passwordPrompt.js b/content/passwordPrompt/passwordPrompt.js
new file mode 100644
index 0000000..8af40d9
--- /dev/null
+++ b/content/passwordPrompt/passwordPrompt.js
@@ -0,0 +1,47 @@
+/*
+ * This file is part of TbSync.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+ "use strict";
+
+var tbSyncPassword = {
+
+ onload: function () {
+ let data = window.arguments[0];
+ this.resolve = window.arguments[1];
+ this.resolved = false;
+
+ this.namefield = document.getElementById("tbsync.account");
+ this.passfield = document.getElementById("tbsync.password");
+ this.userfield = document.getElementById("tbsync.user");
+
+ this.namefield.value = data.accountname;
+ this.userfield.value = data.username;
+ this.userfield.disabled = data.usernameLocked;
+
+ window.addEventListener("unload", tbSyncPassword.doCANCEL.bind(this));
+ document.getElementById("tbsync.password").focus();
+ document.getElementById("tbsync.password.ok").addEventListener("click", tbSyncPassword.doOK.bind(this));
+ document.getElementById("tbsync.password.cancel").addEventListener("click", () => window.close());
+ },
+
+ doOK: function (event) {
+ if (!this.resolved) {
+ this.resolved = true
+ this.resolve({username: this.userfield.value, password: this.passfield.value});
+ window.close();
+ }
+ },
+
+ doCANCEL: function (event) {
+ if (!this.resolved) {
+ this.resolved = true
+ this.resolve(false);
+ }
+ },
+
+};
diff --git a/content/passwordPrompt/passwordPrompt.xhtml b/content/passwordPrompt/passwordPrompt.xhtml
new file mode 100644
index 0000000..fc554b5
--- /dev/null
+++ b/content/passwordPrompt/passwordPrompt.xhtml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
+<?xml-stylesheet href="chrome://tbsync/content/passwordPrompt/passwordPrompt.css" type="text/css"?>
+
+<window
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ title="__TBSYNCMSG_password.title__"
+ onload="tbSyncPassword.onload();">
+
+ <script type="application/javascript" src="chrome://tbsync/content/passwordPrompt/passwordPrompt.js"/>
+ <script type="text/javascript" src="chrome://tbsync/content/scripts/locales.js" />
+
+ <vbox flex="1">
+ <description style="padding: 5px; width: 350px;">__TBSYNCMSG_password.description__</description>
+
+ <html:div class="grid-container">
+ <html:div class="grid-item"><label value="__TBSYNCMSG_password.account__"/></html:div>
+ <html:div class="grid-item"><label class="header" id="tbsync.account" /></html:div>
+ <html:div class="grid-item"><label value="__TBSYNCMSG_password.user__"/></html:div>
+ <html:div class="grid-item"><html:input id="tbsync.user" /></html:div>
+ <html:div class="grid-item"><label value="__TBSYNCMSG_password.password__"/></html:div>
+ <html:div class="grid-item"><html:input type="password" id="tbsync.password"/></html:div>
+ </html:div>
+ <hbox style="padding: 5px">
+ <vbox flex="1"></vbox>
+ <button id="tbsync.password.ok" label="__TBSYNCMSG_password.ok__" />
+ <button id="tbsync.password.cancel" label="__TBSYNCMSG_password.cancel__" />
+ </hbox>
+ </vbox>
+
+</window>