Sanitize RemoteEmail user prop (#27170)
* Sanitize RemoteEmail user prop If the server is configured to hide user emails, the "RemoteEmail" user property will be sanitized as well, effectively hiding the real email of remote users. * fix merge conflict --------- Co-authored-by: Doug Lauder <wiggin77@warpmail.net> Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
59998b0b84
Коммит
2aff84a72e
@@ -384,3 +384,22 @@ func TestValidateCustomStatus(t *testing.T) {
|
||||
assert.True(t, user0.ValidateCustomStatus())
|
||||
})
|
||||
}
|
||||
|
||||
func TestSanitizeProfile(t *testing.T) {
|
||||
t.Run("should correctly sanitize email and remote email", func(t *testing.T) {
|
||||
user := &User{
|
||||
Email: "john@doe.com",
|
||||
Props: StringMap{UserPropsKeyRemoteEmail: "remote@doe.com"},
|
||||
}
|
||||
|
||||
user.SanitizeProfile(nil)
|
||||
|
||||
require.Equal(t, "john@doe.com", user.Email)
|
||||
require.Equal(t, "remote@doe.com", user.Props[UserPropsKeyRemoteEmail])
|
||||
|
||||
user.SanitizeProfile(map[string]bool{"email": false})
|
||||
|
||||
require.Empty(t, user.Email)
|
||||
require.Empty(t, user.Props[UserPropsKeyRemoteEmail])
|
||||
})
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user