Skip to content

Commit

Permalink
Merge pull request #4388 from evertton/fix-admin-setup
Browse files Browse the repository at this point in the history
Add email field to admin account setup #4382
  • Loading branch information
nilsteampassnet authored Oct 2, 2024
2 parents d2a6cff + 862c21d commit 257749c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
27 changes: 21 additions & 6 deletions install/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ function checkPage()
}
} else if (step === "4") {
// STEP 4

// Password checks
if ($("#admin_pwd").val() === "") {
alertify
.error('<i class="fas fa-ban mr-2"></i>You must define a password for Administrator account.', 10)
Expand All @@ -112,13 +114,26 @@ function checkPage()
.error('<i class="fas fa-ban mr-2"></i>Administrator passwords are not similar.', 10)
.dismissOthers();
return false;
} else{
$("#hid_db_pre").val($("#tbl_prefix").val());
jsonValues = {"tbl_prefix":sanitizeString($("#tbl_prefix").val()), "sk_path":sanitizeString($("#sk_path").val()), "admin_pwd":sanitizeString($("#admin_pwd").val()), "send_stats":""};
dataToUse = JSON.stringify(jsonValues);
tasks = ["misc*preparation"];
multiple = "";
}

// Email checks
if ($("#admin_email").val() === "") {
alertify
.error('<i class="fas fa-ban mr-2"></i>You must define an email for Administrator account.', 10)
.dismissOthers();
return false;
} else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test($("#admin_email").val())) {
alertify
.error('<i class="fas fa-ban mr-2"></i>Administrator email is not valid.', 10)
.dismissOthers();
return false;
}

$("#hid_db_pre").val($("#tbl_prefix").val());
jsonValues = {"tbl_prefix":sanitizeString($("#tbl_prefix").val()), "sk_path":sanitizeString($("#sk_path").val()), "admin_pwd":sanitizeString($("#admin_pwd").val()), "admin_email":sanitizeString($("#admin_email").val()), "send_stats":""};
dataToUse = JSON.stringify(jsonValues);
tasks = ["misc*preparation"];
multiple = "";
} else if (step === "5") {
// STEP 5
dataToUse = "";
Expand Down
9 changes: 7 additions & 2 deletions install/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,17 @@
<div class="form-group">
<label>Teampass Administrator password</label>
<input type="password" class="form-control" id="admin_pwd" class="ui-widget" value=""><span id="res4_check10"></span>
</div
</div>
<div class="form-group">
<label>Confirm Administrator password</label>
<input type="password" class="form-control" id="admin_pwd_confirm" class="ui-widget" value=""><span id="res4_check11"></span>
</div
</div>
<div class="form-group">
<label>Administrator email</label>
<input type="text" class="form-control" id="admin_email" class="ui-widget" value=""><span id="res4_check12"></span>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit 257749c

Please sign in to comment.