Skip to content

Adding selector for login shell in account settings #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
20f061a
initial frontend changes to account.php under LoginShell
mckeags7 Oct 13, 2022
201508e
Update account.php
mckeags7 Oct 13, 2022
9fac36a
update account.php
mckeags7 Oct 13, 2022
e1f5266
Update account.php
mckeags7 Oct 13, 2022
4239233
added if statement to account.php
mckeags7 Oct 14, 2022
6305273
cleaned up syntax account.php
mckeags7 Oct 14, 2022
bcf6955
Update account.php
mckeags7 Oct 14, 2022
1ddc32f
got rid of csh/tcsh and fish option
mckeags7 Oct 17, 2022
b694648
update to shell functionality
mckeags7 Oct 18, 2022
ce00916
Update account.php
mckeags7 Oct 18, 2022
c33b18e
fixes to foreach loop in account.php
mckeags7 Oct 19, 2022
e431d71
hardcoded textbox for now.
mckeags7 Oct 19, 2022
d1f625a
Update account.php
mckeags7 Oct 19, 2022
c1e210e
trying to add txtbox visibility
mckeags7 Oct 19, 2022
45ca04e
trying to add getPIGROUP functionality in User Management
mckeags7 Oct 19, 2022
52a9049
Update user-mgmt.php
mckeags7 Oct 19, 2022
647f073
updated config.ini to get rid of custom
mckeags7 Oct 20, 2022
5966b71
added column for PI group under user-mgmt.php
mckeags7 Oct 20, 2022
0f85628
Update user-mgmt.php
mckeags7 Oct 20, 2022
ec558ed
Update user-mgmt.php
mckeags7 Oct 20, 2022
baece3d
Revert "Update user-mgmt.php"
mckeags7 Oct 20, 2022
75b459c
Revert "Update user-mgmt.php"
mckeags7 Oct 20, 2022
2a53fee
Revert "Update user-mgmt.php"
mckeags7 Oct 20, 2022
51d898d
Revert "trying to add getPIGROUP functionality in User Management"
mckeags7 Oct 20, 2022
c93102b
Revert "added column for PI group under user-mgmt.php"
mckeags7 Oct 20, 2022
bfc4383
Final fixes to shell frontend in account.php
mckeags7 Nov 9, 2022
690e076
setLoginShell added custom functionality
mckeags7 Dec 2, 2022
e0249fd
Update webroot/panel/account.php
mckeags7 Dec 14, 2022
a2bf4ae
Update webroot/panel/account.php
mckeags7 Dec 14, 2022
40c540a
Update webroot/panel/account.php
mckeags7 Dec 14, 2022
e42b2c9
Update webroot/panel/account.php
mckeags7 Dec 14, 2022
395d885
Update webroot/panel/account.php
mckeags7 Dec 14, 2022
e7b5d8d
Update webroot/panel/account.php
mckeags7 Dec 14, 2022
b880e60
Update webroot/panel/account.php
mckeags7 Dec 14, 2022
d00161b
Update webroot/panel/account.php
mckeags7 Dec 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config/branding/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ logos[] = "mghpcc.png"
links[] = "https://www.mghpcc.org/"
title[] = "Massachusetts Green High Performance Computing Center"

[loginshell] ; menu items, Login Shells
shell[] = "/bin/bash"
shell[] = "/bin/zsh"

[menuitems] ; menu items, add a label and link for each
labels[] = "Documentation"
links[] = "https://docs.unity.rc.umass.edu/"
Expand Down
73 changes: 62 additions & 11 deletions webroot/panel/account.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@
$USER->setSSHKeys($keys); // Update user keys
break;
case "loginshell":
$USER->setLoginShell($_POST["loginshell"]);
if ($_POST["shellSelect"] == "custom"){
$USER->setLoginShell($_POST["shell"]);
} else {
$USER->setLoginShell($_POST["shellSelect"]);
}
break;
case "pi_request":
if (!$USER->isPI()) {
Expand Down Expand Up @@ -130,23 +134,70 @@

<hr>

<form action="" method="POST">

<input type="hidden" name="form_type" value="loginshell">

<select id="loginSelector" name= "shellSelect">

<option value="" disabled hidden>Select Login Shell...</option>

<?php
$cur_shell = $USER->getLoginShell();
$found_selector = false;
foreach ($BRANDING["loginshell"]["shell"] as $shell) {
if ($cur_shell == $shell){
echo "<option selected>$shell</option>";
$found_selector = true;
} else {
echo "<option>$shell</option>";
}
}

if ($found_selector) {
echo "<option value='custom'>Custom</option>";
} else {
echo "<option value='custom' selected>Custom</option>";
}
?>
</select>
<?php
echo "<h5>Login Shell</h5>";
echo
"<div class='inline'>
<form action='' method='POST'>
<input type='hidden' name='form_type' value='loginshell'>
<input type='text' name='loginshell' placeholder='Login Shell (ie. /bin/bash)'
value=" . $USER->getLoginShell() . " required>
<input type='submit' value='Set Login Shell'>
</form>
</div>";

if ($found_selector) {
echo "<input id='customLoginBox' type='text' placeholder='Enter login shell path (ie. /bin/bash)' name='shell'>";
} else {
echo "<input id='customLoginBox' type='text' placeholder='Enter login shell path (ie. /bin/bash)' name='shell' value='$cur_shell'>";
}
?>
<input type='submit' value='Set Login Shell'>

</form>

<script>
$("button.btnAddKey").click(function() {
openModal("Add New Key", "<?php echo $CONFIG["site"]["prefix"]; ?>/panel/modal/new_key.php");
});

var customLoginBox = $("#customLoginBox");
if (customLoginBox.val() == "") {
// login box is empty, so we hide it by default
// if the login box had a value, that means it would be a custom shell
// and should not hide by default
customLoginBox.hide();
}

$("#loginSelector").change(function() {
var customBox = $("#customLoginBox");
if($(this).val() == "custom") {
customBox.show();
} else {
customBox.hide();
}
});

if ($("#loginSelector").val() == "custom") {
$("#customLoginBox").show();
}
</script>

<style>
Expand Down