Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
add automatic login
Browse files Browse the repository at this point in the history
  • Loading branch information
poVoq committed Mar 23, 2020
1 parent 098d1e6 commit 3d46cb4
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 23 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ ConverseJS-ubports Changelog
v0.2.0
---------------------------
* Update to ConverseJS 6.0.1 (see upstream changes)
* Optional automatic login (use UT tweak tool to reset)
* XEP-0156: Discovering Alternative XMPP Connection support (untested)
* Removed some CSS hacks no longer needed + nicer send buttons
* Re-enabled participant autocomple (with @ but it is still a bit buggy)
* Removed some CSS hacks that are no longer needed
* Re-enabled MUC participant autocomple (with @ but it is a bit buggy)
* Slightly improved HTML login page & logo

v0.1.3
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Please note that this is just a HTML5 wrapper with minimal CSS changes to the Co
[![OpenStore](https://open-store.io/badges/en_US.png)](https://open-store.io/app/conversejs.povoq)

## Known issues
- Does not remember login credentials (server setting are saved but not visible).
- Server setting are saved but are not visible on restart.
- Automatic login can only be reset by using UT tweak tool (delete app data).
- Participant list in multi-user-chats (MUCs) is very cramped on small screens.
- This is a known issue of ConverseJS and is waiting for an upstream improvement.
- XMPP account passwords are stored in plain-text in the qtwebview's sessionStorage (difficult to fix, help wanted).
Expand All @@ -16,7 +17,7 @@ Please note that this is just a HTML5 wrapper with minimal CSS changes to the Co
## Todo
- [x] Initial prototype HTML wrapper with some CSS fixes to the ConverseJS mobile view-mode.
- [x] XEP-0156: Discovering Alternative XMPP Connection Methods (Available since ConverseJS release 6.0.0 but untested).
- [ ] Make logout functional so that logins can be stored in the app.
- [ ] Make in app logout functional to avoid UT tweak tool use.
- [ ] Make nice login and settings landing page with HTML UI toolkit.
- [ ] xmpp: url hooks?
- [ ] Alternative theme support?
Expand Down
60 changes: 41 additions & 19 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,54 +20,76 @@
<body>

<center>
<p></p>
<p></p>
<img src="css/converse_text.png">
<p></p>
<input name="jid" type="email" id="jid" required="" placeholder="Jabber / XMPP ID" />
<p></p>
<input name="password" type="password" id="password" required="" placeholder="Password" />
<p></p>
<button onclick="startconversejs()" type="button"><b>Log in</b></button>
<button onclick="loginTemp()" type="button"><b>Temporary login</b></button>
<p></p>
Or store JID and password in app
<p></p>
<button onclick="loginPerm()" type="button">Automatic login</button>
<p></p>
<H3>Optional settings:</H3>
<H3>Server settings:</H3>
<p></p>
Websocket or BOSH URL of XMPP server
Websocket and/or BOSH URL of server
<p></p>
<input name="websocket" type="url" id="websocket" required="" placeholder="wss://example.com/ws/" />
<p></p>
<input name="bosh" type="url" id="bosh" required="" placeholder="https://example.com/bosh/" />
<p></p>
<button onclick="storeData()" type="button">Save in app-storage</button>
<button onclick="storeData()" type="button">Store server connection</button>
<p></p>
<button onclick="removeData()" type="button">Reset app-storage</button>
(Use UT-Tweak tool to remove all storage)
<p></p>
<a href="https://xmpp-servers.404.city/main.php?recommendation=jix.im" target="_blank">Don't have a XMPP account yet?</a>
</center>

<script type="text/javascript">
// Load permLogin setting
var getlogin = localStorage.getItem("permLogin");
if (getlogin) {startconversejs()};

function loginTemp(){
var inputJid = document.getElementById("jid");
sessionStorage.setItem("jid", inputJid.value);
var inputPass = document.getElementById("password");
sessionStorage.setItem("password", inputPass.value);
startconversejs();
}

function loginPerm(){
var login = true;
localStorage.setItem("permLogin", login.value);
var inputJid = document.getElementById("jid");
localStorage.setItem("jid", inputJid.value);
var inputPass = document.getElementById("password");
localStorage.setItem("password", inputPass.value);
startconversejs();
}

function storeData(){
var inputWs = document.getElementById("websocket");
localStorage.setItem("websocket", inputWs.value);
var inputBosh = document.getElementById("bosh");
localStorage.setItem("bosh", inputBosh.value);
}
function removeData(){
sessionStorage.removeItem("jid");
sessionStorage.removeItem("password");
localStorage.removeItem("websocket");
localStorage.removeItem("bosh");
}
function startconversejs(){

var inputJid = document.getElementById("jid");
sessionStorage.setItem("jid", inputJid.value);
var inputPass = document.getElementById("password");
sessionStorage.setItem("password", inputPass.value);
function startconversejs(){
var getlogin = localStorage.getItem("permLogin");
// ckeck if permanent login
if (getlogin) {
var getJid = localStorage.getItem("jid");
var getPass = localStorage.getItem("password");
} else {
var getJid = sessionStorage.getItem("jid");
var getPass = sessionStorage.getItem("password");
};

var getJid = sessionStorage.getItem("jid");
var getPass = sessionStorage.getItem("password");
// Load stored server settings
var getWs = localStorage.getItem("websocket");
var getBosh = localStorage.getItem("bosh");

Expand Down

0 comments on commit 3d46cb4

Please sign in to comment.