Skip to content
Snippets Groups Projects
Commit 8759388f authored by Florent Gluck's avatar Florent Gluck
Browse files

server:

- log when a user account gets locked

client:
- tpledit was buggy. Fixed.
- validate script didn't stop if authentication failed
- validate script: added tpledit and vmedit tests
- bumped to version 1.8.4
parent f85cf907
No related branches found
No related tags found
No related merge requests found
......@@ -75,8 +75,8 @@ func (cmd *Edit)Run(args []string) int {
return statusCode
}
func (cmd *Edit)parseArgs(args []string) (*params.TplCreate, error) {
p := &params.TplCreate{}
func (cmd *Edit)parseArgs(args []string) (*params.TplEdit, error) {
p := &params.TplEdit{}
atLeastOneArg := false
getStringVal := func(s string, prefix string) string {
......
......@@ -68,7 +68,7 @@ email=$1
echo "Log in..."
export NEXUS_TOKEN=`$nexus_cli login $email`
if [ $? -ne 0 ]; then
if [ -z $NEXUS_TOKEN ]; then
echo "[FATAL] login failed."
exit 1
fi
......@@ -158,8 +158,6 @@ done
echo -e "\nStress tests completed.\n"
exit 0
echo "Create base VM..."
vm_id=`$nexus_cli vmcreate "$vm_base_name" 2 1024 user 067b:2303 $base_template_id`
check_last_cmd_succeeded "vmcreate"
......@@ -179,11 +177,21 @@ template_id=`echo $template_id | grep \"id\" | awk -F'"' '{print $4}'`
check_valid_uuid $template_id
OK
echo "Edit template (name)..."
$nexus_cli tpledit "$template_id" name="$vm_tpl_name extra"
check_last_cmd_succeeded "tpledit"
OK
echo "Create students VMs..."
$nexus_cli vmcreate "$vm_base_name" 2 1024 none 1fc9:0132,03eb:6124 $template_id data/students.csv
check_last_cmd_succeeded "vmcreate VMs"
OK
echo "Edit students VMs (cpus)..."
$nexus_cli vmedit "$vm_base_name" cpus=4
check_last_cmd_succeeded "vmedit VMs"
OK
echo "Start students VMs..."
$nexus_cli vmstart "$vm_base_name"
check_last_cmd_succeeded "vmstart VMs"
......
......@@ -8,7 +8,7 @@ import (
const (
major = 1
minor = 8
bugfix = 3
bugfix = 4
)
type Version struct {
......
......@@ -11,6 +11,6 @@ type TplCreate struct {
}
type TplEdit struct {
Name string `json:"name"`
Access string `json:"access"`
Name string `json:"name" validate:"required,min=2"`
Access string `json:"access" validate:"required,min=4"`
}
......@@ -105,6 +105,7 @@ func (auth *Auth)Login(c echo.Context) error {
delete(loginLocked, user.Email)
delete(loginAttempts, user.Email)
} else {
log.Info("Account ", user.Email ," is still locked")
return echo.NewHTTPError(http.StatusUnauthorized, "Account is locked")
}
}
......@@ -119,6 +120,7 @@ func (auth *Auth)Login(c echo.Context) error {
if count >= maxloginAttempts {
// Locks the account.
loginLocked[user.Email] = time.Now()
log.Info("Account ", user.Email ," is locked: too many wrong password attempts!")
return echo.NewHTTPError(http.StatusUnauthorized, "Account is locked")
}
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment