I have a custom app i want to make function to receive the informations who is connected

I want to know the informations the user who is connected

Hii @yasmineslema1

To retrieve information about the currently logged-in user in a Frappe custom application, you can utilize frappe.session.user. This provides user details. Below is an example function that gives you details of the logged-in user:

def get_current_user_info():
    user = frappe.session.user
    if user == "Guest":
        return {"message": "No user is currently logged in."}

    user_doc = frappe.get_doc("User", user)
    user_info = {
        "full_name": user_doc.full_name,
        "email": user_doc.email,
        "last_login": user_doc.last_login,
        "user_type": user_doc.user_type
    }
    return user_info

Note:- This does not work for guest users.