---
name: "Lemonldap::NG::Portal::Password"
section: "3pm"
platform: "linux"
package: "liblemonldap-ng-portal-perl"
version: "2.21.2+ds-1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Lemonldap::NG::Portal::Password"
---

# Lemonldap::NG::Portal::Password(3pm)

Writing password modification modules for LemonLDAP::NG.

## NAME

Lemonldap:NG::Portal::Password - Writing password modification modules for LemonLDAP::NG.

## SYNOPSIS

```
    package Lemonldap::NG::Portal::Password::My;
    use strict;
    use Mouse;
    # Add constants used by this module
    use Lemonldap::NG::Portal::Main::Constants qw(PE_OK);
    our $VERSION = '0.1';
    extends 'Lemonldap::NG::Portal::Password::Base';
    sub init {
        my ($self) = @_;
        ...
    }
    sub confirm {
        my ( $self, $req, $old_password ) = @_;
        ...
    }
    sub modifyPassword {
        my ( $self, $req, $new_password, %args ) = @_;
        ...
    }
```

## DESCRIPTION

Password modules are used to modify the user's password in regular password change operations or password reset operations. Password modules are independent objects that are instantiated by Lemonldap::NG portal. They must provide methods described below.

## METHODS

### Accessors and methods provided by Lemonldap::NG::Common::Module

- p: portal object

  - conf: configuration hash (as reference)

  - logger alias for p-\>logger accessor

  - userLogger alias for p-\>userLogger accessor

  ### Methods that must be provided by a Password module

***init()***

Method launched after object creation (after each configuration reload). It must return a true value if initialization was successful.

*Methods called on demand*

All these methods must return a Lemonldap::NG::Portal::Main::Constants value. They are called with one argument: a Lemonldap::NG::Portal::Main::Request object.

confirm($req, `$old_password`)

This method is called to validate that the supplied old password is correct. This is slightly different from authentication in the sense that an expired old password cannot be used to login but can be used to set a new password.

modifyPassword($req, `$new_password`, `%args`)

This method is called to perform the actual password change.

Possible args:

- passwordReset: set in the case of a password reset (old password is not known) =item useMail: set if $req-\>user contains the user's email

  ## LOGGING

Logging is provided by `$self`-\>logger and `$self`-\>userLogger. The following rules must be applied:

- logger-\>debug: technical debugging messages

  - logger-\>info: simple technical information

  - logger-\>notice: technical information that could interest administrators

  - logger-\>warn: technical warning

  - logger-\>error: error that must be reported to administrator

  - userLogger-\>info: simple information about user's action

  - userLogger-\>notice: information that may be registered (auth success,...)

  - userLogger-\>warn: bad action of a user (auth failure). Auth/Combination transform it to "info" when another authentication scheme is available

  - userLogger-\>error: bad action of a user that must be reported, (even if another backend is available with Combination)

  ## AUTHORS

- LemonLDAP::NG team \<http://lemonldap-ng.org/team\>

  ## BUG REPORT

Use OW2 system to report bug or ask for features: \<https://gitlab.ow2.org/lemonldap-ng/lemonldap-ng/issues\>

## DOWNLOAD

Lemonldap::NG is available at \<https://lemonldap-ng.org/download\>

## COPYRIGHT AND LICENSE

See COPYING file for details.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program.  If not, see \<http://www.gnu.org/licenses/\>.
