The password must be provided when creating a new user (#954)

This commit is contained in:
Alex Tselegidis 2020-12-11 21:18:33 +02:00
parent 9ad3ed929f
commit 2dc5439b5d
3 changed files with 15 additions and 1 deletions

View file

@ -116,6 +116,11 @@ class Admins_model extends EA_Model {
}
}
if ( ! isset($admin['id']) && ! isset($admin['settings']['password']))
{
throw new Exception('The user password cannot be empty for new users.');
}
// Validate calendar view mode.
if (isset($admin['settings']['calendar_view']) && ($admin['settings']['calendar_view'] !== CALENDAR_VIEW_DEFAULT
&& $admin['settings']['calendar_view'] !== CALENDAR_VIEW_TABLE))

View file

@ -73,7 +73,6 @@ class Providers_model extends EA_Model {
*/
public function validate($provider)
{
// If a provider id is present, check whether the record exist in the database.
if (isset($provider['id']))
{
@ -147,6 +146,11 @@ class Providers_model extends EA_Model {
}
}
if ( ! isset($provider['id']) && ! isset($provider['settings']['password']))
{
throw new Exception('The user password cannot be empty for new users.');
}
// Validate calendar view mode.
if (isset($provider['settings']['calendar_view']) && ($provider['settings']['calendar_view'] !== CALENDAR_VIEW_DEFAULT
&& $provider['settings']['calendar_view'] !== CALENDAR_VIEW_TABLE))

View file

@ -124,6 +124,11 @@ class Secretaries_model extends EA_Model {
}
}
if ( ! isset($secretary['id']) && ! isset($secretary['settings']['password']))
{
throw new Exception('The user password cannot be empty for new users.');
}
// Validate calendar view mode.
if (isset($secretary['settings']['calendar_view']) && ($secretary['settings']['calendar_view'] !== CALENDAR_VIEW_DEFAULT
&& $secretary['settings']['calendar_view'] !== CALENDAR_VIEW_TABLE))