mirror of
				https://github.com/ClusterCockpit/cc-backend
				synced 2025-11-04 09:35:07 +01:00 
			
		
		
		
	Fixes #15: Copy JWT to clipboard automatically
This commit is contained in:
		@@ -49,6 +49,7 @@
 | 
				
			|||||||
        <div class="card-body">
 | 
					        <div class="card-body">
 | 
				
			||||||
            <h5 class="card-title">Special Users</h5>
 | 
					            <h5 class="card-title">Special Users</h5>
 | 
				
			||||||
            <p>Not created by an LDAP sync and/or having a role other than <code>user</code></p>
 | 
					            <p>Not created by an LDAP sync and/or having a role other than <code>user</code></p>
 | 
				
			||||||
 | 
					            <!-- <p id="generated-jwt" style="font-weight: bold;"></p> -->
 | 
				
			||||||
            <div style="width: 100%; max-height: 500px; overflow-y: scroll;">
 | 
					            <div style="width: 100%; max-height: 500px; overflow-y: scroll;">
 | 
				
			||||||
                <table class="table">
 | 
					                <table class="table">
 | 
				
			||||||
                    <thead>
 | 
					                    <thead>
 | 
				
			||||||
@@ -91,7 +92,13 @@
 | 
				
			|||||||
                            let username = row.children[0].innerText
 | 
					                            let username = row.children[0].innerText
 | 
				
			||||||
                            fetch(`/api/jwt/?username=${username}`)
 | 
					                            fetch(`/api/jwt/?username=${username}`)
 | 
				
			||||||
                                .then(res => res.text())
 | 
					                                .then(res => res.text())
 | 
				
			||||||
                                .then(text => alert(text))
 | 
					                                .then(text => {
 | 
				
			||||||
 | 
					                                    // let elm = document.querySelector('#generated-jwt')
 | 
				
			||||||
 | 
					                                    // elm.innerText = `JWT: ${text}`
 | 
				
			||||||
 | 
					                                    // elm.scrollIntoView()
 | 
				
			||||||
 | 
					                                    event.target.parentElement.innerHTML = `<textarea rows="3" cols="20">${text}</textarea>`
 | 
				
			||||||
 | 
					                                    navigator.clipboard.writeText(text).catch(reason => console.error(reason))
 | 
				
			||||||
 | 
					                                })
 | 
				
			||||||
                        }))
 | 
					                        }))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        listElement.querySelectorAll('button.del-user').forEach(e => e.addEventListener('click', event => {
 | 
					                        listElement.querySelectorAll('button.del-user').forEach(e => e.addEventListener('click', event => {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user