PasswordManagement

This class contains all functions for the process of password reset and creating new administration users and sending email to those with a link to set the password.

All this functions were implemented in UserManagementController before.

package

Default

Methods

PasswordManagement constructor.

__construct( $user)

Arguments

$user

\User

This function prepare the email template to send to the new created user

generateAdminCreationEmail(): mixed

Response

mixed

$aAdminEmail array with subject and email body

Creates a random password through the core plugin

getRandomPassword(integer $length = self::MIN_PASSWORD_LENGTH): string|null
static
todo

it's fine to use static functions, until it is used only in controllers ...

Arguments

$length

integer

Length of the password

Response

string|null

getRenderArray

getRenderArray(): array

Response

array

Checks if user is allowed to do the next sending of email for forgotten password.

isAllowedToSendForgotPwEmail(\User $user): boolean

This should only be the case all 5min (see self::MIN_TIME_NEXT_FORGOT_PW_EMAIL)

Throws
\Exception

Arguments

$user

\User

Response

boolean

true if user can send another email for forgotten pw, false otherwise

Send the registration email to a new survey administrator

sendAdminMail(string $type = self::EMAIL_TYPE_REGISTRATION): \LimeMailer
Throws
\PHPMailer\PHPMailer\Exception

Arguments

$type

string

two types are available 'resetPassword' or 'registration', default is 'registration'

Response

\LimeMailer

if send is successful

Sets the validationKey and the validationKey expiration and sends email to the user, containing the link to set/reset password.

sendPasswordLinkViaEmail(string $emailType): array
Throws
\PHPMailer\PHPMailer\Exception

Arguments

$emailType

string

this could be 'registration' or 'resetPassword' (see const in this class)

Response

array

message if sending email to user was successful

Constants

MIN_PASSWORD_LENGTH

MIN_PASSWORD_LENGTH

EMAIL_TYPE_REGISTRATION

EMAIL_TYPE_REGISTRATION

EMAIL_TYPE_RESET_PW

EMAIL_TYPE_RESET_PW

MIN_TIME_NEXT_FORGOT_PW_EMAIL

MIN_TIME_NEXT_FORGOT_PW_EMAIL

Properties

\User

user :
var

\User

Type(s)