Skip to content

Commit

Permalink
Middleware: rename get_cookie_from_request to session_cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesm committed Oct 28, 2024
1 parent 7ac1bfc commit 69aef56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions middleware.ml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ let user_from_auth_cookie cookie users =
| Some user -> Ok user
| None -> Error (`Msg "User not found")

let get_cookie_from_request reqd =
let session_cookie reqd =
match cookie User_model.session_cookie reqd with
| Some auth_cookie -> (
match cookie_value auth_cookie with
Expand All @@ -146,7 +146,7 @@ let get_cookie_from_request reqd =
Error (`Msg "User not found")

let user_of_cookie users now reqd =
match get_cookie_from_request reqd with
match session_cookie reqd with
| Ok auth_cookie -> (
match user_from_auth_cookie auth_cookie users with
| Ok user -> (
Expand Down
6 changes: 3 additions & 3 deletions unikernel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ struct
(fun reqd ->
match Middleware.user_of_cookie users now reqd with
| Ok user -> (
match Middleware.get_cookie_from_request reqd with
match Middleware.session_cookie reqd with
| Ok cookie_value -> (
match
User_model.user_auth_cookie_from_user cookie_value user
Expand Down Expand Up @@ -587,7 +587,7 @@ struct
`OK)

let account_page store reqd (user : User_model.user) =
match Middleware.get_cookie_from_request reqd with
match Middleware.session_cookie reqd with
| Ok cookie_value -> (
match User_model.user_auth_cookie_from_user cookie_value user with
| Some cookie -> (
Expand Down Expand Up @@ -711,7 +711,7 @@ struct
~data:"Update password: expected a dictionary" `Bad_request

let close_sessions store reqd (user : User_model.user) =
match Middleware.get_cookie_from_request reqd with
match Middleware.session_cookie reqd with
| Ok cookie_value -> (
match User_model.user_auth_cookie_from_user cookie_value user with
| Some cookie -> (
Expand Down

0 comments on commit 69aef56

Please sign in to comment.