mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2026-04-22 20:51:56 +02:00
Validate password before creating user
This commit is contained in:
@@ -90,14 +90,16 @@ function validateEmail() {
|
|||||||
function updatePassword() {
|
function updatePassword() {
|
||||||
identityId=$1
|
identityId=$1
|
||||||
|
|
||||||
# Read password from stdin (show prompt only if no stdin was piped in)
|
if [ -z "$password" ]; then
|
||||||
test -t 0
|
# Read password from stdin (show prompt only if no stdin was piped in)
|
||||||
if [[ $? == 0 ]]; then
|
test -t 0
|
||||||
echo "Enter new password:"
|
if [[ $? == 0 ]]; then
|
||||||
fi
|
echo "Enter new password:"
|
||||||
read -s password
|
fi
|
||||||
|
read -s password
|
||||||
|
|
||||||
validatePassword "$password"
|
validatePassword "$password"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -n $identityId ]]; then
|
if [[ -n $identityId ]]; then
|
||||||
# Generate password hash
|
# Generate password hash
|
||||||
@@ -199,6 +201,7 @@ case "${operation}" in
|
|||||||
[[ "$email" == "" ]] && fail "Email address must be provided"
|
[[ "$email" == "" ]] && fail "Email address must be provided"
|
||||||
|
|
||||||
validateEmail "$email"
|
validateEmail "$email"
|
||||||
|
updatePassword
|
||||||
createUser "$email"
|
createUser "$email"
|
||||||
echo "Successfully added new user to SOC"
|
echo "Successfully added new user to SOC"
|
||||||
check_container thehive && echo $password | so-thehive-user-add "$email"
|
check_container thehive && echo $password | so-thehive-user-add "$email"
|
||||||
|
|||||||
Reference in New Issue
Block a user