Skip to content

Commit ea2ea8d

Browse files
committed
renames UserEmail to UserEmailAddress
1 parent b55c8f1 commit ea2ea8d

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/FsTweet.Web/Auth.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module Domain =
3434
| None ->
3535
return! AR.fail UsernameNotFound
3636
| Some user ->
37-
match user.Email with
37+
match user.EmailAddress with
3838
| NotVerified _ ->
3939
return! AR.fail EmailNotVerified
4040
| Verified _ ->

src/FsTweet.Web/User.fs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,18 @@ type PasswordHash = private PasswordHash of string with
6161
static member VerifyPassword (password : Password) (passwordHash : PasswordHash) =
6262
BCrypt.Verify(password.Value, passwordHash.Value)
6363

64-
type UserEmail =
64+
type UserEmailAddress =
6565
| Verified of EmailAddress
6666
| NotVerified of EmailAddress
67+
with member this.Value =
68+
match this with
69+
| Verified e | NotVerified e ->
70+
e.Value
6771

6872
type User = {
6973
UserId : UserId
7074
Username : Username
71-
Email : UserEmail
75+
EmailAddress : UserEmailAddress
7276
PasswordHash : PasswordHash
7377
}
7478

@@ -84,19 +88,19 @@ module Persistence =
8488
let! username = Username.TryCreate user.Username
8589
let! passwordHash = PasswordHash.TryCreate user.PasswordHash
8690
let! email = EmailAddress.TryCreate user.Email
87-
let userEmail =
91+
let userEmailAddress =
8892
match user.IsEmailVerified with
8993
| true -> Verified email
9094
| _ -> NotVerified email
9195
return {
9296
UserId = UserId user.Id
9397
Username = username
9498
PasswordHash = passwordHash
95-
Email = userEmail
99+
EmailAddress = userEmailAddress
96100
}
97101
}
98102
userResult
99-
|> mapFailure (System.Exception)
103+
|> mapFailure System.Exception
100104
|> Async.singleton
101105
|> AR
102106
let findUser (getDataCtx : GetDataContext) (username : Username) = asyncTrial {

0 commit comments

Comments
 (0)