Open Source Content Management Framework

PHP midgard_user method password

  1. Example

Set user's password.

bool password(name, password, [hashtype]);

midgard_user method password takes three arguments.

  • user's name ( login )
  • user's password
  • password hashtype

Available password's hashtypes:

  • MIDGARD_USER_HASH_LEGACY (default)
  • MIDGARD_USER_HASH_LEGACY_PLAIN
  • MIDGARD_USER_HASH_MD5
  • MIDGARD_USER_HASH_PLAIN
  • MIDGARD_USER_HASH_SHA1
  • MIDGARD_USER_HASH_PAM

Returns TRUE on success, FALSE otherwise.

In Ragnaroek generation, only legacy types are available. In Vinland, all types are available and legacy ones are fully compatible with Ragnaroek's authentication system.

When logged in as user:

  • you are able to change only your own password

When logged in as admin:

  • you are able to change your own password
  • you are able to change password of any user within te same domain(sitegroup)

When logged in as root:

  • you are able to change any user' password

Example

<?php

$user = midgard_user::auth("john", "password"); 
$password_is_set = 
    $user->password("john", "notsecret", MIDGARD_USER_HASH_LEGACY_PLAIN)

if($password_is_set)
{
    echo "Password has been changed"; 
} 

?>
Tagged
ragnaroek
vinland
Designed by Nemein, hosted by Kafit