Documentation

Passwd_Driver_Sql extends Passwd_Driver
in package

Changes a password stored in an SQL database.

Tags
author

Mike Cochrane mike@graftonhall.co.nz

author

Mattias Webjörn Eriksson mattias@webjorn.org

author

Ilya Krel mail@krel.org

author

Ralf Lang lang@b1-systems.de (H4 conversion)

author

Eric Jon Rostetter eric.rostetter@physics.utexas.edu

author

Tjeerd van der Zee admin@xar.nl

category

Horde

copyright

2000-2017 Horde LLC

license

http://www.horde.org/licenses/gpl GPL

Table of Contents

$_db  : Horde_Db_Adapter
Handle for the current database connection.
$_params  : array<string|int, mixed>
Hash containing configuration parameters.
__construct()  : mixed
Constructor.
changePassword()  : mixed
Changes the user's password.
_changePassword()  : mixed
Changes the user's password.
_comparePasswords()  : mixed
Compares a plaintext password with an encrypted password.
_encryptPassword()  : string
Encrypts a password.
_lookup()  : mixed
Finds out if a username and password is valid.
_modify()  : mixed
Modifies a SQL password record for a user.
_parseQuery()  : string
Parses the string as an SQL query substituting placeholders for their values.

Properties

$_db

Handle for the current database connection.

protected Horde_Db_Adapter $_db

$_params

Hash containing configuration parameters.

protected array<string|int, mixed> $_params = array()

Methods

__construct()

Constructor.

public __construct([array<string|int, mixed> $params = array() ]) : mixed
Parameters
$params : array<string|int, mixed> = array()

Driver parameters:

  • db: (Horde_Db_Adapter; REQUIRED) A DB Adapter object.
  • encryption: (string) The encryption type.
  • pass_col: (string) The table column for password.
  • query_lookup: (string) Should we use a custom query for lookup?
  • query_modify: (string) Should we use a custom query for changing?
  • show_encryption: (boolean) Prepend the encryption type to the password?
  • table: (string) The name of the user database table.
  • user_col: (string) The table column for user name.
Return values
mixed

changePassword()

Changes the user's password.

public changePassword(string $user, string $oldpass, string $newpass) : mixed
Parameters
$user : string

The user for which to change the password.

$oldpass : string

The old (current) user password.

$newpass : string

The new user password to set.

Tags
throws
Passwd_Exception
Return values
mixed

_changePassword()

Changes the user's password.

protected _changePassword(mixed $user, mixed $oldpass, mixed $newpass) : mixed
Parameters
$user : mixed

The user for which to change the password (converted to backend username).

$oldpass : mixed

The old (current) user password.

$newpass : mixed

The new user password to set.

Return values
mixed

_comparePasswords()

Compares a plaintext password with an encrypted password.

protected _comparePasswords(string $encrypted, string $plaintext) : mixed
Parameters
$encrypted : string

An encrypted password.

$plaintext : string

An unencrypted password.

Tags
throws
Passwd_Exception

if passwords don't match.

Return values
mixed

_encryptPassword()

Encrypts a password.

protected _encryptPassword(string $plaintext) : string
Parameters
$plaintext : string

A plaintext password.

Return values
string

The encrypted password.

_lookup()

Finds out if a username and password is valid.

protected _lookup(mixed $user, string $oldpass) : mixed
Parameters
$user : mixed
$oldpass : string

An old password to check.

Tags
throws
Passwd_Exception
Return values
mixed

_modify()

Modifies a SQL password record for a user.

protected _modify(string $user, string $newpass) : mixed
Parameters
$user : string

The user whose record we will udpate.

$newpass : string

The new password value to set.

Tags
throws
Passwd_Exception
Return values
mixed

_parseQuery()

Parses the string as an SQL query substituting placeholders for their values.

protected _parseQuery(string $string, string $user, string $password) : string
Parameters
$string : string

The string to process as a query.

$user : string

The user to use for the %u placeholder.

$password : string

The password to use for the %p and %e placeholders.

Return values
string

The processed SQL query.

Search results