From 1db5e99a707617bf17d66f05b4ae0a1f1986c587 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 8 Nov 2010 13:41:58 +0000 Subject: [PATCH] Updated registration process git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20203 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../Register/class_RegistrationDialog.inc | 64 +++++++++++++-- .../generic/dashBoard/Register/register.tpl | 81 +++++++++++++++++-- 2 files changed, 131 insertions(+), 14 deletions(-) diff --git a/gosa-core/plugins/generic/dashBoard/Register/class_RegistrationDialog.inc b/gosa-core/plugins/generic/dashBoard/Register/class_RegistrationDialog.inc index 72f0b4eae..9fdc23a23 100644 --- a/gosa-core/plugins/generic/dashBoard/Register/class_RegistrationDialog.inc +++ b/gosa-core/plugins/generic/dashBoard/Register/class_RegistrationDialog.inc @@ -49,7 +49,7 @@ class RegistrationDialog extends plugin if($this->selectedRegistrationType == "registered"){ // Register user - print_a($this->rpcHandle->registerUser('cajus', $this->values)); + print_a($this->rpcHandle->registerUser($this->values['uid'], $this->values)); // Register Instance with User. } @@ -66,9 +66,43 @@ class RegistrationDialog extends plugin // Checking for a valid 'uid'. if(empty($this->values['uid'])) { $message[] = msgPool::required(_("Account-ID")); - }elseif(!preg_match("/^[a-z0-9_-]+$/", $this->values['uid'])){ + }elseif(preg_match('/[^a-z0-9_\-]/', $this->values['uid'])){ $message[] = msgPool::invalid(_("Account-ID"), $this->values['uid'],'/[a-z0-9_-]/'); } + + // Checking for a valid 'mailAddress'. + if(empty($this->values['mailAddress'])) { + $message[] = msgPool::required(_("Mail address")); + }elseif(!tests::is_email($this->values['mailAddress'])){ + $message[] = msgPool::invalid(_("Mail address"), $this->values['mailAddress']); + } + + // Checking for a valid 'password'. + if(empty($this->values['password'])) { + $message[] = msgPool::required(_("Password")); + }elseif($this->values['password'] != $this->values['password_repeated']){ + $message[] = _("The given password and repeated password do not match!"); + } + + // Checking for a valid password restore message. + if(empty($this->values['restoreQuestion'])) { + $message[] = msgPool::required(_("Password restore question")); + } + + // Checking for a valid restore answer. + if(empty($this->values['restoreAnswer'])) { + $message[] = msgPool::required(_("Password restore answer")); + } + + // Checking for a valid 'givenName'. + if(empty($this->values['givenName'])) { + $message[] = msgPool::required(_("Given name")); + } + + // Checking for a valid surname. + if(empty($this->values['surname'])) { + $message[] = msgPool::required(_("Surname")); + } } return($message); @@ -77,12 +111,23 @@ class RegistrationDialog extends plugin function execute() { - // Registration request. - if(isset($_POST['registerNow'])){ + // Registration page one filled in, next step requested. + if(isset($_POST['registerPage2'])){ + $msgs = $this->check(); + if(count($msgs)){ + msg_dialog::displayChecks($msgs); + }else{ + $this->step = 2; + } + } + + // Registration page one filled in, next step requested. + if(isset($_POST['registerPage3'])){ $msgs = $this->check(); if(count($msgs)){ msg_dialog::displayChecks($msgs); }else{ + $this->step = 200; $this->registerNow(); } } @@ -101,13 +146,18 @@ class RegistrationDialog extends plugin function save_object() { + // get Newsletter Checkbox value + if($this->step == 1){ + $this->values['newsletter'] = isset($_POST['newsletter']); + } + foreach($this->attrs as $attr){ + if(isset($_POST[$attr])) $this->values[$attr] = get_post($attr); + } + if(isset($_POST['registrationType'])) $this->selectedRegistrationType = get_post('registrationType'); if(isset($_POST['startRegistration'])) $this->step = 1; if(isset($_POST['stepBack'])) $this->step -= 1; - foreach($this->attrs as $attr){ - if(isset($_POST[$attr])) $this->values[$attr] = get_post($attr); - } } } ?> diff --git a/gosa-core/plugins/generic/dashBoard/Register/register.tpl b/gosa-core/plugins/generic/dashBoard/Register/register.tpl index 55e3d977f..e3c4c4e71 100644 --- a/gosa-core/plugins/generic/dashBoard/Register/register.tpl +++ b/gosa-core/plugins/generic/dashBoard/Register/register.tpl @@ -79,7 +79,7 @@ - + @@ -93,9 +93,8 @@ - {factory type='password' name='password' id='password' + {factory type='password' name='password' id='password' value={$password} onkeyup="testPasswordCss(\$('password').value)"} - @@ -112,7 +111,7 @@ - {factory type='password' name='password_repeated' id='password_repeated'} + {factory type='password' name='password_repeated' id='password_repeated' value={$password_repeated}} @@ -158,25 +157,93 @@
({$must} {t}Required fields{/t}) - - {/if}
- +
{/if} + {if $step == 2} +

{t}Company information{/t}

+ + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+
+ +

{t}Contact information{/t}

+ + + + + + + + + +
+ +
+ +
+
+ +

{t}Details{/t}

+ + + + + + + + + + + + + +
+ +
+ +
+ +
+
+
{/if} -- 2.30.2