From 2a481de5574a5db8823cf5323c9207551a52763d Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Fri, 28 Mar 2014 03:34:06 +0000 Subject: [PATCH] Add ability to force password change while registering the user. --- include/class.user.php | 2 ++ include/staff/templates/user-register.tmpl.php | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/class.user.php b/include/class.user.php index f9e38f1fe..ad54875fb 100644 --- a/include/class.user.php +++ b/include/class.user.php @@ -768,6 +768,8 @@ class UserAccount extends UserAccountModel { if ($vars['passwd1'] && !$vars['sendemail']) { $account->set('passwd', Password::hash($vars['passwd1'])); $account->setStatus(self::CONFIRMED); + if ($vars['pwreset-flag']) + $account->setStatus(self::PASSWD_RESET_REQUIRED); } $account->save(true); diff --git a/include/staff/templates/user-register.tmpl.php b/include/staff/templates/user-register.tmpl.php index 996636578..8f87c41a3 100644 --- a/include/staff/templates/user-register.tmpl.php +++ b/include/staff/templates/user-register.tmpl.php @@ -47,7 +47,7 @@ $user->getName()->getOriginal(); ?></b>.</p></div> <td> <input type="checkbox" id="sendemail" name="sendemail" value="1" <?php echo $info['sendemail'] ? 'checked="checked"' : ''; ?> > - Send account confirmation email to user. + Send account activation email to <?php echo $user->getEmail(); ?>. </td> </tr> <tr> @@ -82,6 +82,15 @@ $user->getName()->getOriginal(); ?></b>.</p></div> <span class="error"> <?php echo $errors['passwd2']; ?></span> </td> </tr> + <tr> + <td> + Password Change: + </td> + <td colspan=2> + <input type="checkbox" name="pwreset-flag" value="1" <?php + echo $info['pwreset-flag'] ? 'checked="checked"' : ''; ?>> Require password change on login + </td> + </tr> </tbody> <tbody> <tr> -- GitLab