[evolvis-commits] r7034: [#967] admins can register users and activate them in one go, skipping eMail↵

mirabilos at evolvis.org mirabilos at evolvis.org
Wed Oct 6 16:01:28 CEST 2010


Author: mirabilos
Date: 2010-10-06 16:01:28 +0200 (Wed, 06 Oct 2010)
New Revision: 7034

Modified:
   trunk/gforge_base/evolvisforge/gforge/debian/changelog
   trunk/gforge_base/evolvisforge/gforge/www/account/register.php
Log:
[#967] admins can register users and activate them in one go, skipping eMail


Modified: trunk/gforge_base/evolvisforge/gforge/debian/changelog
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/debian/changelog	2010-10-06 12:39:51 UTC (rev 7033)
+++ trunk/gforge_base/evolvisforge/gforge/debian/changelog	2010-10-06 14:01:28 UTC (rev 7034)
@@ -20,8 +20,10 @@
   * visualise PM and Tracker history output better
   * for login/logout, implement return_to current URI again
   * update address information in the imprint
+  * implement adding users as admin without confirmation eMail and
+    activating them immediately [#967]
 
- -- Thorsten Glaser <t.glaser at tarent.de>  Mon, 04 Oct 2010 09:44:05 +0200
+ -- Thorsten Glaser <t.glaser at tarent.de>  Wed, 06 Oct 2010 15:01:31 +0200
 
 gforge (4.8.3+evolvis25) unstable; urgency=low
 

Modified: trunk/gforge_base/evolvisforge/gforge/www/account/register.php
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/www/account/register.php	2010-10-06 12:39:51 UTC (rev 7033)
+++ trunk/gforge_base/evolvisforge/gforge/www/account/register.php	2010-10-06 14:01:28 UTC (rev 7034)
@@ -76,14 +76,42 @@
 	} else if ($email == "x") {
 		$feedback = '<div style="color:green;"><b>OK, not registered.</b></div>';
 	} else {
+		$activate_immediately = getStringFromRequest(''activate_immediately');
+		if (($activate_immediately == 1) &&
+		    session_checkperm(array('group'=>'1','admin_flags'=>'A'))) {
+			$send_mail = false;
+			$activate_immediately = true;
+		} else {
+			$send_mail = true;
+			$activate_immediately = false;
+		}
 		$new_user = new GFUser();
 		$register = $new_user->create($unix_name,$firstname,$lastname,$password1,$password2,
 			$email,$mail_site,$mail_va,$language_id,$timezone,$jabber_address,$jabber_only,$theme_id,'',
-			$address,$address2,$phone,$fax,$title,$ccode);
+			$address,$address2,$phone,$fax,$title,$ccode,$send_mail);
 		if ($register) {
 			echo $HTML->header(array('title'=>'Register Confirmation'));
 
-			printf(_('<p>Congratulations. You have registered on %1$s.</p><p>You are now being sent a confirmation email to verify your email address. Visiting the link sent to you in this email will activate your account.</p>'), $sys_name);
+			if ($activate_immediately) {
+				$e = '';
+				if (!$new_user->setStatus('A'))
+					$e .= '<p>' . sprintf(_('Could not activate newly registered user’s forge account: %s'), htmlspecialchars($new_user->getErrorMessage())) . '</p>';
+				else if (!$new_user->setUnixStatus('A'))
+					$e .= '<p>' . sprintf(_('Could not activate newly registered user’s unix account: %s'), htmlspecialchars($new_user->getErrorMessage())) . '</p>';
+				if ($e) {
+					print '<span class="error">' .
+					    _('Error during user activation but after user registration (user is now in pending state and will not get a notification eMail!)') .
+					    '</span>' . $e;
+					$HTML->footer(array());
+					exit;
+				}
+				plugin_hook('add_cal_user', $unix_name);
+			}
+			if ($send_mail) {
+				printf(_('<p>Congratulations. You have registered on %1$s.</p><p>You are now being sent a confirmation email to verify your email address. Visiting the link sent to you in this email will activate your account.</p>'), $sys_name);
+			} else {
+				printf(_('<p>You have registered and activated user %1$s on %2$s. They will not receive an eMail about this fact.</p>'), $unix_name, $sys_name);
+			}
 			echo $HTML->footer(array());
 			exit;
 		} else {
@@ -199,6 +227,9 @@
 <p>
 <?php printf(_('Fields marked with %s are mandatory.'), utils_requiredField()); ?>
 </p>
+<?php if (session_checkperm(array('group'=>'1','admin_flags'=>'A'))) { ?>
+	<p><input type="checkbox" name="activate_immediately" value="1" /></p>
+<?php } ?>
 <p>
 <input type="submit" name="submit" value="<?php echo _('Register'); ?>" />
 </p>



More information about the evolvis-commits mailing list