mirror of
https://github.com/jech/galene.git
synced 2024-11-10 02:35:58 +01:00
Add link for changing password.
This commit is contained in:
parent
077ff9a879
commit
10cab468a8
3 changed files with 42 additions and 2 deletions
|
@ -99,6 +99,16 @@
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#chpwspan a {
|
||||||
|
padding: 4px 0;
|
||||||
|
font-size: 0.9em;
|
||||||
|
color: #e4157e;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chpwspan.invisible {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.sidenav .user-logout a {
|
.sidenav .user-logout a {
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
padding: 7px 0 0;
|
padding: 7px 0 0;
|
||||||
|
|
|
@ -153,6 +153,7 @@
|
||||||
<div class="profile-info">
|
<div class="profile-info">
|
||||||
<span id="userspan"></span>
|
<span id="userspan"></span>
|
||||||
<span id="permspan"></span>
|
<span id="permspan"></span>
|
||||||
|
<span id="chpwspan" class="invisible"><a id="change-password">Change password</a></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="user-logout">
|
<div class="user-logout">
|
||||||
<a id="disconnectbutton">
|
<a id="disconnectbutton">
|
||||||
|
|
|
@ -29,6 +29,9 @@ let serverConnection;
|
||||||
/** @type {Object} */
|
/** @type {Object} */
|
||||||
let groupStatus = {};
|
let groupStatus = {};
|
||||||
|
|
||||||
|
/** @type {boolean} */
|
||||||
|
let pwAuth = false;
|
||||||
|
|
||||||
/** @type {string} */
|
/** @type {string} */
|
||||||
let token = null;
|
let token = null;
|
||||||
|
|
||||||
|
@ -331,6 +334,24 @@ async function gotConnected() {
|
||||||
await join(again);
|
await join(again);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} username
|
||||||
|
*/
|
||||||
|
function setChangePassword(username) {
|
||||||
|
let s = document.getElementById('chpwspan');
|
||||||
|
let a = s.children[0];
|
||||||
|
if(!(a instanceof HTMLAnchorElement))
|
||||||
|
throw new Error('Bad type for chpwspan');
|
||||||
|
if(username) {
|
||||||
|
a.href = `/change-password.html?group=${encodeURI(group)}&username=${encodeURI(username)}`;
|
||||||
|
a.target = '_blank';
|
||||||
|
s.classList.remove('invisible');
|
||||||
|
} else {
|
||||||
|
a.href = null;
|
||||||
|
s.classList.add('invisible');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {boolean} again
|
* @param {boolean} again
|
||||||
*/
|
*/
|
||||||
|
@ -338,6 +359,7 @@ async function join(again) {
|
||||||
let username = getInputElement('username').value.trim();
|
let username = getInputElement('username').value.trim();
|
||||||
let credentials;
|
let credentials;
|
||||||
if(token) {
|
if(token) {
|
||||||
|
pwAuth = false;
|
||||||
credentials = {
|
credentials = {
|
||||||
type: 'token',
|
type: 'token',
|
||||||
token: token,
|
token: token,
|
||||||
|
@ -349,15 +371,18 @@ async function join(again) {
|
||||||
} else {
|
} else {
|
||||||
let pw = getInputElement('password').value;
|
let pw = getInputElement('password').value;
|
||||||
getInputElement('password').value = '';
|
getInputElement('password').value = '';
|
||||||
if(!groupStatus.authServer)
|
if(!groupStatus.authServer) {
|
||||||
|
pwAuth = true;
|
||||||
credentials = pw;
|
credentials = pw;
|
||||||
else
|
} else {
|
||||||
|
pwAuth = false;
|
||||||
credentials = {
|
credentials = {
|
||||||
type: 'authServer',
|
type: 'authServer',
|
||||||
authServer: groupStatus.authServer,
|
authServer: groupStatus.authServer,
|
||||||
location: location.href,
|
location: location.href,
|
||||||
password: pw,
|
password: pw,
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -2459,6 +2484,7 @@ async function gotJoined(kind, group, perms, status, data, error, message) {
|
||||||
this.close();
|
this.close();
|
||||||
token = null;
|
token = null;
|
||||||
setButtonsVisibility();
|
setButtonsVisibility();
|
||||||
|
setChangePassword(null);
|
||||||
return;
|
return;
|
||||||
case 'join':
|
case 'join':
|
||||||
case 'change':
|
case 'change':
|
||||||
|
@ -2469,6 +2495,9 @@ async function gotJoined(kind, group, perms, status, data, error, message) {
|
||||||
setTitle((status && status.displayName) || capitalise(group));
|
setTitle((status && status.displayName) || capitalise(group));
|
||||||
displayUsername();
|
displayUsername();
|
||||||
setButtonsVisibility();
|
setButtonsVisibility();
|
||||||
|
setChangePassword(pwAuth && !!groupStatus.canChangePassword &&
|
||||||
|
serverConnection.username
|
||||||
|
);
|
||||||
if(kind === 'change')
|
if(kind === 'change')
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue