package ocsigen-start

Build not yet checked
  1. Overview
  2. Docs
Higher-level library for developing Web and mobile applications with users, registration, notifications, etc

Install

dune-project
 Dependency

Authors

Maintainers

Sources

9.0.0.tar.gz
md5=dfd00a648f0d5f64fcfc893427afc996
sha512=d7c77a9f9b617291ea8c49f4e77fcad8187c39e41d6cb2942ad1c8f45ba620ac261d25a3e75c1b2ce1fd429dad009abb45fab670542e722ab336dc681b99330a

doc/ocsigen-start.server/Os/Current_user/index.html

Module Os.Current_user

This module provides functions and types to manage the current user.

On server side, this will work only if the current request in wrapped in Session.connected_wrapper, or Session.connected_fun, etc. Otherwise, an exception is raised.

type current_user =
  1. | CU_idontknown
  2. | CU_notconnected
  3. | CU_user of Types.User.t
val get_current_user : unit -> Types.User.t

get_current_user () returns the current user as a Types.User.t type. If no user is connected, it fails with Session.Not_connected.

val get_current_userid : unit -> Types.User.id

get_current_userid () returns the ID of the current user. If no user is connected, it fails with Session.Not_connected.

module Opt : sig ... end

Instead of exception, the module Opt returns an option.

val remove_email_from_user : string -> unit Lwt.t

remove_email_from_user email removes the email email of the current user. If no user is connected, it fails with Session.Not_connected. If email is the main email of the current user, it fails with Db.Main_email_removal_attempt.

val update_main_email : string -> unit Lwt.t

update_main_email email sets the main email of the current user to email. If no user is connected, it fails with Session.Not_connected.

val update_language : string -> unit Lwt.t

update_language language updates the language of the current user. If no user is connected, it fails with Session.Not_connected.

val is_email_validated : string -> bool Lwt.t

is_email_validated email returns true if email is a valided email for the current user. If no user is connected, it fails with Session.Not_connected. It returns false in all other cases.

val is_main_email : string -> bool Lwt.t

is_main_email email returns true if email is the main email of the current user.