mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Password policy (#82268)
* add password service interface * add password service implementation * add tests for password service * add password service wiring * add feature toggle * Rework from service interface to static function * Replace previous password validations * Add codeowners to password service * add error logs * update config files --------- Co-authored-by: Karl Persson <kalle.persson@grafana.com>
This commit is contained in:
@@ -70,7 +70,7 @@ func validateUserEmailCode(cfg *setting.Cfg, user *user.User, code string) (bool
|
||||
}
|
||||
|
||||
// right active code
|
||||
payload := strconv.FormatInt(user.ID, 10) + user.Email + user.Login + user.Password + user.Rands
|
||||
payload := strconv.FormatInt(user.ID, 10) + user.Email + user.Login + string(user.Password) + user.Rands
|
||||
expectedCode, err := createTimeLimitCode(cfg.SecretKey, payload, minutes, startStr)
|
||||
if err != nil {
|
||||
return false, err
|
||||
@@ -103,7 +103,7 @@ func getLoginForEmailCode(code string) string {
|
||||
|
||||
func createUserEmailCode(cfg *setting.Cfg, user *user.User, startStr string) (string, error) {
|
||||
minutes := cfg.EmailCodeValidMinutes
|
||||
payload := strconv.FormatInt(user.ID, 10) + user.Email + user.Login + user.Password + user.Rands
|
||||
payload := strconv.FormatInt(user.ID, 10) + user.Email + user.Login + string(user.Password) + user.Rands
|
||||
code, err := createTimeLimitCode(cfg.SecretKey, payload, minutes, startStr)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
||||
@@ -18,7 +18,7 @@ func TestTimeLimitCodes(t *testing.T) {
|
||||
user := &user.User{ID: 10, Email: "t@a.com", Login: "asd", Password: "1", Rands: "2"}
|
||||
|
||||
format := "200601021504"
|
||||
mailPayload := strconv.FormatInt(user.ID, 10) + user.Email + user.Login + user.Password + user.Rands
|
||||
mailPayload := strconv.FormatInt(user.ID, 10) + user.Email + user.Login + string(user.Password) + user.Rands
|
||||
tenMinutesAgo := time.Now().Add(-time.Minute * 10)
|
||||
|
||||
tests := []struct {
|
||||
|
||||
Reference in New Issue
Block a user