Skip to content

Commit 5e65ed9

Browse files
authored
Revert "Disallow email change to blocked domain (#4624)" (#4745)
This reverts commit b480a34. This is because https://wearezeta.atlassian.net/browse/WPB-19643 should be released now. Otherwise, we'd need some configuration changes to the cloud that aren't done, yet.
1 parent b480a34 commit 5e65ed9

File tree

25 files changed

+179
-561
lines changed

25 files changed

+179
-561
lines changed

changelog.d/1-api-changes/no-email-change-to-blocked-domains

Lines changed: 0 additions & 14 deletions
This file was deleted.

hls.json

Lines changed: 0 additions & 163 deletions
This file was deleted.

integration/integration.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ library
112112
Test.AssetUpload
113113
Test.Auth
114114
Test.B2B
115-
Test.BlockedDomains
116115
Test.Bot
117116
Test.Brig
118117
Test.Cargohold.API

integration/test/API/Brig.hs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -422,21 +422,12 @@ putSelfLocale caller locale = do
422422
--
423423
-- NOTE: the full process of changing (and confirming) the email address is more complicated.
424424
-- see /services/brig/test/integration for details.
425-
putUserEmail :: (HasCallStack, MakesValue caller, MakesValue target) => caller -> target -> String -> App Response
426-
putUserEmail caller target emailAddress = do
427-
uid <- asString $ target %. "id"
428-
req <- baseRequest caller Brig Versioned $ joinHttpPath ["users", uid, "email"]
425+
putSelfEmail :: (HasCallStack, MakesValue caller) => caller -> String -> App Response
426+
putSelfEmail caller emailAddress = do
427+
callerid <- asString $ caller %. "id"
428+
req <- baseRequest caller Brig Versioned $ joinHttpPath ["users", callerid, "email"]
429429
submit "PUT" $ req & addJSONObject ["email" .= emailAddress]
430430

431-
putSelfEmail :: (HasCallStack, MakesValue user) => user -> String -> String -> String -> App Response
432-
putSelfEmail user cookie token emailAddress = do
433-
req <- baseRequest user Brig Versioned "/access/self/email"
434-
submit "PUT" $
435-
req
436-
& setCookie cookie
437-
& addHeader "Authorization" ("Bearer " <> token)
438-
& addJSONObject ["email" .= emailAddress]
439-
440431
-- | https://staging-nginz-https.zinfra.io/v6/api/swagger-ui/#/default/delete_self_email
441432
deleteSelfEmail :: (HasCallStack, MakesValue caller) => caller -> App Response
442433
deleteSelfEmail caller = do
@@ -891,11 +882,6 @@ activate domain key code = do
891882
req
892883
& addQueryParams [("key", key), ("code", code)]
893884

894-
activateSend :: (HasCallStack, MakesValue domain) => domain -> String -> Maybe String -> App Response
895-
activateSend domain email locale = do
896-
req <- rawBaseRequest domain Brig Versioned $ joinHttpPath ["activate", "send"]
897-
submit "POST" $ req & addJSONObject (["email" .= email] <> maybeToList (((.=) "locale") <$> locale))
898-
899885
acceptTeamInvitation :: (HasCallStack, MakesValue user) => user -> String -> Maybe String -> App Response
900886
acceptTeamInvitation user code mPw = do
901887
req <- baseRequest user Brig Versioned $ joinHttpPath ["teams", "invitations", "accept"]

integration/test/Test/BlockedDomains.hs

Lines changed: 0 additions & 111 deletions
This file was deleted.

integration/test/Test/User.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ testUpdateSelf (MkTagged mode) = do
169169
-- allowed unconditionally *for owner* (this is a bit off-topic: team members can't
170170
-- change their email addresses themselves under any conditions)
171171
someEmail <- (<> "@example.com") . UUID.toString <$> liftIO UUID.nextRandom
172-
bindResponse (putUserEmail owner owner someEmail) $ \resp -> do
172+
bindResponse (putSelfEmail owner someEmail) $ \resp -> do
173173
resp.status `shouldMatchInt` 200
174174
TestUpdateLocale -> do
175175
-- scim maps "User.preferredLanguage" to brig's locale field. allowed unconditionally.

libs/types-common/src/Data/Domain.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import Data.ByteString qualified as BS
3232
import Data.ByteString.Builder qualified as Builder
3333
import Data.ByteString.Char8 qualified as BS.Char8
3434
import Data.ByteString.Conversion
35-
import Data.Hashable
3635
import Data.OpenApi qualified as S
3736
import Data.Schema
3837
import Data.Text qualified as Text
@@ -67,7 +66,6 @@ newtype Domain = Domain {_domainText :: Text}
6766
deriving stock (Eq, Ord, Generic, Show)
6867
deriving newtype (S.ToParamSchema, Binary)
6968
deriving (FromJSON, ToJSON, S.ToSchema) via Schema Domain
70-
deriving (Hashable)
7169

7270
instance ToSchema Domain where
7371
schema =

libs/wire-api/src/Wire/API/Error/Brig.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ type instance
293293
'StaticError
294294
451
295295
"domain-blocked-for-registration"
296-
"[Customer extension] The email domain has been blocked for Wire users. Please contact your IT department."
296+
"[Customer extension] the email domain example.com \
297+
\that you are attempting to register a user with has been \
298+
\blocked for creating wire users. Please contact your IT department."
297299

298300
type instance MapError 'PasswordResetInProgress = 'StaticError 409 "code-exists" "A password reset is already in progress."
299301

libs/wire-subsystems/src/Wire/TeamInvitationSubsystem/Error.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ data TeamInvitationSubsystemError
1515
| TeamInvitationEmailTaken
1616
| TeamInvitationInvalidEmail
1717
| TeamInvitationNotAllowedForEmail
18-
| TeamInvitationBlockedDomain
1918
deriving (Eq, Show)
2019

2120
instance Exception TeamInvitationSubsystemError
@@ -30,4 +29,3 @@ teamInvitationErrorToHttpError =
3029
TeamInvitationEmailTaken -> errorToWai @E.EmailExists
3130
TeamInvitationInvalidEmail -> errorToWai @E.InvalidEmail
3231
TeamInvitationNotAllowedForEmail -> Wai.mkError status403 "condition-failed" "Emails from this domain are not allowed to be invited to this team"
33-
TeamInvitationBlockedDomain -> errorToWai @E.CustomerExtensionBlockedDomain

0 commit comments

Comments
 (0)