<?xml version="1.0" encoding="utf-8"?>
<KScriptSetting>
  <Name>User</Name>
  <Description>Kooboo login user available from version 1.1 and up</Description>
  <Example>
    <![CDATA[  
<script engine="kscript">

    if (k.request.username)
    {  
       var user = k.user.login(k.request.username, k.request.password);  
    }  
 
    if (!k.user.isLogin)
    {
        k.response.write("user not login"); 
    }
</script>   
	]]>
  </Example>
  <Props>
    <Property>
      <Name>userName</Name>
      <Description>user name of current kooboo login user.</Description>
      <Type>string</Type>
    </Property>
    <Property>
      <Name>id</Name>
      <Description>user id</Description>
      <Type>string</Type>
    </Property>
    <Property>
      <Name>firstName</Name>
      <Description>user first name</Description>
      <Type>string</Type>
    </Property>
    <Property>
      <Name>lastName</Name>
      <Description>user last name</Description>
      <Type>string</Type>
    </Property>

    <Property>
      <Name>language</Name>
      <Description>user language</Description>
      <Type>string</Type>
    </Property>

    <Property>
      <Name>isLogin</Name>
      <Description>where there is a login user or not</Description>
      <Type>bool</Type>
    </Property>

  </Props>
  <Methods>
    <Method>
      <Name>login</Name>
      <Description>Validate a kooboo user login information and return the user info if succeed</Description>
      <Example>

 <![CDATA[  
<script engine="kscript">

    if (k.request.username)
    {  
       var user = k.user.login(k.request.username, k.request.password);  
    }  
 
    if (!k.user.isLogin)
    {
        k.response.write("user not login"); 
    }
</script>   
	]]>

      </Example>
      <Params>
        <Param>
          <Name>userName</Name>
          <Description>user name</Description>
          <Type>string</Type>
        </Param>
        <Param>
          <Name>password</Name>
          <Description>password</Description>
          <Type>string</Type>
        </Param>

      </Params>
    </Method>


    <Method>
      <Name>logout</Name>
      <Description>logout current login user</Description>
      <Example>
        <![CDATA[  
<script engine="kscript">
          if (k.user.isLogin)
          {
          k.user.logout();

          k.response.redirect("/__kb/view/login");
          }
          else
          {
          k.response.write("you are not login");
          }
</script> 
	]]>
 
      </Example>
      <Params>
      </Params>
    </Method> 

  </Methods>
</KScriptSetting>