From d1cee022471f43decafc4da0bff7892ff52f0664 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 20 Nov 2017 11:04:04 -0600 Subject: Refactor password validation and config defaults (#7859) * refactor password validation and config defaults * reorder config lines for clarity --- app/authentication.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/authentication.go') diff --git a/app/authentication.go b/app/authentication.go index 809c2e6c7..91e3bf564 100644 --- a/app/authentication.go +++ b/app/authentication.go @@ -11,6 +11,13 @@ import ( "github.com/mattermost/mattermost-server/utils" ) +func (a *App) IsPasswordValid(password string) *model.AppError { + if utils.IsLicensed() && *utils.License().Features.PasswordRequirements { + return utils.IsPasswordValidWithSettings(password, &a.Config().PasswordSettings) + } + return utils.IsPasswordValid(password) +} + func (a *App) CheckPasswordAndAllCriteria(user *model.User, password string, mfaToken string) *model.AppError { if err := a.CheckUserAdditionalAuthenticationCriteria(user, mfaToken); err != nil { return err -- cgit v1.2.3-1-g7c22