Prettied up UI for password resets. Now to move on to email component.
This commit is contained in:
parent
ed698f40c7
commit
3671b43789
5 changed files with 51 additions and 18 deletions
|
|
@ -286,6 +286,7 @@ class adminUserList{
|
|||
this.userNames = document.querySelectorAll(".admin-user-list-name");
|
||||
this.rankSelectors = document.querySelectorAll(".admin-user-list-rank-select");
|
||||
this.banIcons = document.querySelectorAll(".admin-user-list-ban-icon");
|
||||
this.passResetIcons = document.querySelectorAll(".admin-user-list-pw-reset-icon");
|
||||
|
||||
this.setupInput();
|
||||
}
|
||||
|
|
@ -318,6 +319,10 @@ class adminUserList{
|
|||
for(let banIcon of this.banIcons){
|
||||
banIcon.addEventListener("click", this.banPopup.bind(this));
|
||||
}
|
||||
|
||||
for(let passResetIcon of this.passResetIcons){
|
||||
passResetIcon.addEventListener("click", this.genResetLink.bind(this))
|
||||
}
|
||||
}
|
||||
|
||||
async setRank(event){
|
||||
|
|
@ -327,6 +332,35 @@ class adminUserList{
|
|||
this.updateSelect(await adminUtil.setUserRank(user, rank), event.target);
|
||||
}
|
||||
|
||||
async genResetLink(event){
|
||||
//Scrape user
|
||||
const user = event.target.id.replace("admin-user-list-pw-reset-icon-","");
|
||||
|
||||
const URL = (await adminUtil.genPasswordResetLink(user)).url;
|
||||
|
||||
//Create span
|
||||
const span = document.createElement('span');
|
||||
//Usually not into doing CSS this way, but I'm not making a dedicated file for a popup this small...
|
||||
span.style = "text-align: center; display: block;"
|
||||
|
||||
//Create header
|
||||
const header = document.createElement('h3');
|
||||
header.innerText = `Reset Link for ${user}`
|
||||
|
||||
//Create link
|
||||
const link = document.createElement('a');
|
||||
link.innerText = "Reset Link"
|
||||
link.href = URL;
|
||||
|
||||
//Append link to the header
|
||||
span.appendChild(header);
|
||||
span.appendChild(link);
|
||||
|
||||
//Display link in pop-up
|
||||
new canopyUXUtils.popup(span.outerHTML);
|
||||
|
||||
}
|
||||
|
||||
banPopup(event){
|
||||
const user = event.target.id.replace("admin-user-list-ban-icon-","");
|
||||
new canopyAdminUtils.banUserPopup(user, userBanList.renderBanList.bind(userBanList));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue