diff options
author | 2022-05-09 01:31:46 -0700 | |
---|---|---|
committer | 2022-05-09 10:31:46 +0200 | |
commit | b24b71c0a4ca9c86e1d5db12e9472c6ab1ecd5f5 (patch) | |
tree | 03f35f6f3fe2b2fa4cd26dae9fd820d355e16668 /internal/validate/formvalidation_test.go | |
parent | [bugfix] Fix remote media pruning failing if media already gone (#548) (diff) | |
download | gotosocial-b24b71c0a4ca9c86e1d5db12e9472c6ab1ecd5f5.tar.xz |
[feature] Include password strength in error message when password strength is too low (#550)
* When password validation fails, return how close to enough entropy it has.
* Shorter version of low-strength password error message
Diffstat (limited to 'internal/validate/formvalidation_test.go')
-rw-r--r-- | internal/validate/formvalidation_test.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/validate/formvalidation_test.go b/internal/validate/formvalidation_test.go index 23e0307db..7b92b9a8c 100644 --- a/internal/validate/formvalidation_test.go +++ b/internal/validate/formvalidation_test.go @@ -50,22 +50,22 @@ func (suite *ValidationTestSuite) TestCheckPasswordStrength() { err = validate.NewPassword(terriblePassword) if assert.Error(suite.T(), err) { - assert.Equal(suite.T(), errors.New("insecure password, try including more special characters, using uppercase letters, using numbers or using a longer password"), err) + assert.Equal(suite.T(), errors.New("password is 62% strength, try including more special characters, using uppercase letters, using numbers or using a longer password"), err) } err = validate.NewPassword(weakPassword) if assert.Error(suite.T(), err) { - assert.Equal(suite.T(), errors.New("insecure password, try including more special characters, using numbers or using a longer password"), err) + assert.Equal(suite.T(), errors.New("password is 95% strength, try including more special characters, using numbers or using a longer password"), err) } err = validate.NewPassword(shortPassword) if assert.Error(suite.T(), err) { - assert.Equal(suite.T(), errors.New("insecure password, try including more special characters or using a longer password"), err) + assert.Equal(suite.T(), errors.New("password is 39% strength, try including more special characters or using a longer password"), err) } err = validate.NewPassword(specialPassword) if assert.Error(suite.T(), err) { - assert.Equal(suite.T(), errors.New("insecure password, try including more special characters or using a longer password"), err) + assert.Equal(suite.T(), errors.New("password is 53% strength, try including more special characters or using a longer password"), err) } err = validate.NewPassword(longPassword) |