Overview
Comment:Fix user import: trim only email address
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: 0cb95b50f8ef5900e8725b581ddb2e70b8d7dd3befc16a71187d40db6bad733a
User & Date: bohwaz on 2021-11-09 23:58:48
Other Links: manifest | tags
Context
2021-11-11
22:01
Redirect to login page after logout, and use configured website URL if provided, for return URL check-in: 430a3c262c user: bohwaz tags: trunk, stable
2021-11-09
23:58
Fix user import: trim only email address check-in: 0cb95b50f8 user: bohwaz tags: trunk, stable
23:57
Redirect to preview instead of list check-in: 7cc4962e47 user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Membres.php from [beb8c739dd] to [f55e10008f].

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
                {
                    continue;
                }
            }

            if (isset($data[$key]))
            {
                $data[$key] = trim($data[$key]);

                if ($config->type == 'datetime' && trim($data[$key]) !== '')
                {
                    $dt = \DateTime::createFromFormat('Y-m-d H:i', $data[$key]);
                    if (!$dt) {
                        throw new UserException(sprintf('Format invalide pour le champ "%s": AAAA-MM-JJ HH:mm attendu.', $config->title));
                    }
                    $data[$key] = $dt->format('Y-m-d H:i');







<
<







39
40
41
42
43
44
45


46
47
48
49
50
51
52
                {
                    continue;
                }
            }

            if (isset($data[$key]))
            {


                if ($config->type == 'datetime' && trim($data[$key]) !== '')
                {
                    $dt = \DateTime::createFromFormat('Y-m-d H:i', $data[$key]);
                    if (!$dt) {
                        throw new UserException(sprintf('Format invalide pour le champ "%s": AAAA-MM-JJ HH:mm attendu.', $config->title));
                    }
                    $data[$key] = $dt->format('Y-m-d H:i');
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
                    if (empty($data[$key]))
                    {
                        $data[$key] = 0;
                    }
                }
                elseif ($config->type == 'email')
                {
                    $data[$key] = strtolower($data[$key]);

                    if (trim($data[$key]) !== '' && !SMTP::checkEmailIsValid($data[$key], false))
                    {
                        throw new UserException(sprintf('Adresse email invalide "%s" pour le champ "%s".', $data[$key], $config->title));
                    }
                }
                elseif ($config->type == 'select' && !in_array($data[$key], $config->options))







|







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
                    if (empty($data[$key]))
                    {
                        $data[$key] = 0;
                    }
                }
                elseif ($config->type == 'email')
                {
                    $data[$key] = strtolower(trim($data[$key]));

                    if (trim($data[$key]) !== '' && !SMTP::checkEmailIsValid($data[$key], false))
                    {
                        throw new UserException(sprintf('Adresse email invalide "%s" pour le champ "%s".', $data[$key], $config->title));
                    }
                }
                elseif ($config->type == 'select' && !in_array($data[$key], $config->options))