Commit e9daca97 authored by Tristan A Spakes's avatar Tristan A Spakes

Work on Add User portion of logger

parent 5ea17d13
Pipeline #23246 passed with stages
in 1 minute and 31 seconds
......@@ -5,7 +5,10 @@ function addUser() {
var uid = document.getElementById("addUserTextbox").value //Retrieve UID
var sudo = document.getElementById("addUserCheckbox").checked //Retieve if sudo is checked or not
ipcRenderer.send('log', 'ORNL Toolbox: Submitted Add User request', 'info')
if(uid.length != 3 || /^[a-z0-9]+$/.test(uid) == false) {
ipcRenderer.send('log', 'ORNL Toolbox: Invalid UID submitted for Add User', 'err')
alert('Please enter a valid 3 character UID')
return
}
......@@ -16,6 +19,7 @@ function addUser() {
name = execSync(`ldapsearch -x "(uid=${uid})" | sed -n 's/^[ \\t]*cn:[ \\t]*\\(.*\\)/\\1/p'`)
name = (name.toString()).trim()
} catch(error) {
ipcRenderer.send('log', 'ORNL Toolbox: Failed to set name in Add User', 'err')
console.error(error)
return
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment