Commit e4327dae authored by Nigel McNie's avatar Nigel McNie
Browse files

Send an e-mail message to a user when a new account is created for them via Add User.

Added a line of descriptive text to the page to help admins understand what will happen on this page.

Corrected a language string when the password for the new user is in invalid form.
parent 829e5801
......@@ -179,7 +179,7 @@ function adduser_validate(Pieform $form, $values) {
}
if (method_exists($authobj, 'is_password_valid') && !$authobj->is_password_valid($password)) {
$form->set_error('password', get_string('addusererrorinvalidpassword', 'admin'));
$form->set_error('password', get_string('passwordinvalidform', 'auth.' . $authobj->type));
return;
}
......@@ -243,6 +243,11 @@ function adduser_submit(Pieform $form, $values) {
handle_event('createuser', $user);
db_commit();
email_user($user, $USER, get_string('accountcreated'),
get_string('accountcreatedtext', 'mahara', $user->firstname, get_config('sitename'), $user->username, $user->password, get_config('sitename')),
get_string('accountcreatedhtml', 'mahara', $user->firstname, get_config('sitename'), $user->username, $user->password, get_config('sitename'))
);
redirect('/admin/users/edit.php?id='.$id);
}
......
......@@ -285,6 +285,7 @@ $string['confirmremoveuserfrominstitution'] = 'Are you sure you want to remove t
// Add User
$string['adduser'] = 'Add User';
$string['adduserdescription'] = 'Create a new user';
$string['adduserpagedescription'] = '<p>Here you may add a new user to the system. Once added, they will be sent an e-mail informing them of their new account, including their username and password. They will be asked to change their password upon first log in.</p>';
$string['createuser'] = 'Create User';
// Login as
......
......@@ -103,6 +103,34 @@ $string['linksandresources'] = 'Links and Resources';
$string['accessforbiddentoadminsection'] = 'You are forbidden from accessing the administration section';
$string['accountdeleted'] = 'Sorry, your account has been deleted';
$string['accountexpired'] = 'Sorry, your account has expired';
$string['accountcreated'] = get_config('sitename') . ': New account';
$string['accountcreatedtext'] = 'Dear %s,
A new account has been created for you on %s. Your details are as follows:
Username: %s
Password: %s
Once you log in for the first time, you will be asked to change your password.
Visit ' . get_config('wwwroot') . ' to get started!
Regards, %s Site Administrator';
$string['accountcreatedhtml'] = '<p>Dear %s</p>
<p>A new account has been created for you on <a href="' . get_config('wwwroot') . '">%s</a>. Your details are as follows:</p>
<ul>
<li><strong>Username:</strong> %s</li>
<li><strong>Password:</strong> %s</li>
</ul>
<p>Once you log in for the first time, you will be asked to change your password.</p>
<p>Visit <a href="' . get_config('wwwroot') . '">' . get_config('wwwroot') . '</a> to get started!</p>
<p>Regards, %s Site Administrator</p>
';
$string['accountexpirywarning'] = 'Account expiry warning';
$string['accountexpirywarningtext'] = 'Dear %s,
......
......@@ -3,6 +3,7 @@
{include file="columnfullstart.tpl"}
<div id="edituser">
<h2>{str tag=adduser section=admin}</h2>
{str tag=adduserpagedescription section=admin}
{$form}
</div>
{include file="columnfullend.tpl"}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment