DokuWiki

It's better when it's simple

User Tools

Site Tools


Sidebar

Translations of this page?:

Learn about DokuWiki

Advanced Use

Corporate Use

Our Community


Follow us on Facebook, Twitter and other social networks.

tips:change_user_name_after_authentication

Change user name after authentication

If you implemented a custom authentication backend and want to change the username provide by the user after authentication, e.g. you want to allow login via a unique id that could change sometime (e.g. email address), but use another unmodifiable unique id as permanent identifier in Dokuwiki. Then implement your checkPass function with the $user parameter passed by reference:

function checkPass(&$user,$pass)
{
  if(user_authenticated($user,$pass)){
    $user = $some_unique_id_fetched_from_your_own_user_db; // you can now change the user and it will be changed in the calling scope as well
    return true;
  }else{
    return false;
  }
}
tips/change_user_name_after_authentication.txt · Last modified: 2012-04-19 14:50 by 81.83.17.184