package sihl-user

  1. Overview
  2. Docs

Parameters

module Repo : sig ... end

Signature

module Web : sig ... end
val find_opt : user_id:string -> Sihl__.Contract_user.t option Lwt.t
val find : user_id:string -> Sihl__.Contract_user.t Lwt.t
val find_by_email : email:string -> Sihl__.Contract_user.t Lwt.t

find_by_email email returns a User.t if there is a user with email address email. Raises an {!Exception} otherwise.

val find_by_email_opt : email:string -> Sihl__.Contract_user.t option Lwt.t

find_by_email_opt email returns a User.t if there is a user with email address email.

val update_password : ?password_policy:(string -> (unit, string) Result.t) -> user:Sihl__.Contract_user.t -> old_password:string -> new_password:string -> new_password_confirmation:string -> unit -> (Sihl__.Contract_user.t, string) Result.t Lwt.t
val update_details : user:Sihl__.Contract_user.t -> email:string -> username:string option -> Sihl__.Contract_user.t Lwt.t
val set_password : ?password_policy:(string -> (unit, string) Result.t) -> user:Sihl__.Contract_user.t -> password:string -> password_confirmation:string -> unit -> (Sihl__.Contract_user.t, string) Result.t Lwt.t

Set the password of a user without knowing the old password.

This feature is typically used by admins.

val create : email:string -> password:string -> username:string option -> admin:bool -> confirmed:bool -> (Sihl__.Contract_user.t, string) Stdlib.result Lwt.t
val create_user : email:string -> password:string -> username:string option -> Sihl__.Contract_user.t Lwt.t

Create and store a user.

val create_admin : email:string -> password:string -> username:string option -> Sihl__.Contract_user.t Lwt.t

Create and store a user that is also an admin.

val register_user : ?password_policy:(string -> (unit, string) Stdlib.result) -> ?username:string -> email:string -> password:string -> password_confirmation:string -> unit -> (Sihl__.Contract_user.t, Sihl__.Contract_user.error) Result.t Lwt.t

Create and store new user.

Provide password_policy to check whether the password fulfills certain criteria.

val login : email:string -> password:string -> (Sihl__.Contract_user.t, Sihl__.Contract_user.error) Result.t Lwt.t

Find user by email if password matches.

val register : unit -> Sihl__.Core_container.Service.t
val lifecycle : Sihl__.Core_container.lifecycle
OCaml

Innovation. Community. Security.