From: <al...@us...> - 2007-08-19 13:13:17
|
Revision: 511 http://sciret.svn.sourceforge.net/sciret/?rev=511&view=rev Author: alpeb Date: 2007-08-19 06:13:15 -0700 (Sun, 19 Aug 2007) Log Message: ----------- new repeat password field to avoid typos Modified Paths: -------------- branches/release-candidates/sciret-1.2/actions/EditUser.php branches/release-candidates/sciret-1.2/templates/EditUser.tpl branches/release-candidates/sciret-1.2/views/EditUser.php Modified: branches/release-candidates/sciret-1.2/actions/EditUser.php =================================================================== --- branches/release-candidates/sciret-1.2/actions/EditUser.php 2007-08-19 13:12:37 UTC (rev 510) +++ branches/release-candidates/sciret-1.2/actions/EditUser.php 2007-08-19 13:13:15 UTC (rev 511) @@ -43,11 +43,14 @@ $missingFieldsArr[] = $this->user->lang('password'); } - if (!$user->setPassword($_POST['password'])) { + $invalidPassword = false; + if ($_POST['password'] != $_POST['password2']) { + $_SESSION['message'] = $this->user->lang('Password and Repeat Password fields don\'t match'); + $invalidPassword = true; + } + elseif (!$user->setPassword($_POST['password'])) { $_SESSION['message'] = $this->user->lang('Invalid password. Please don\'t use any of these characters: %s', implode($user->getDisallowedPasswordChars())); $invalidPassword = true; - } else { - $invalidPassword = false; } if ($missingFieldsArr) { @@ -77,11 +80,12 @@ Library::redirect(Library::getLink(array('view' => 'EditUser', 'userId' => $user->getId()))); } - if ($_POST['password'] != '') { - if (!$user->changePassword($_POST['password'])) { - $_SESSION['message'] = $this->user->lang('Invalid password. Please don\'t use any of these characters: %s', implode(', ', $user->getDisallowedPasswordChars())); - Library::redirect(Library::getLink(array('view' => 'EditUser', 'userId' => $user->getId()))); - } + if ($_POST['password'] != $_POST['password2']) { + $_SESSION['message'] = $this->user->lang('Password and Repeat Password fields don\'t match'); + Library::redirect(Library::getLink(array('view' => 'EditUser', 'userId' => $user->getId()))); + } elseif (!$user->changePassword($_POST['password'])) { + $_SESSION['message'] = $this->user->lang('Invalid password. Please don\'t use any of these characters: %s', implode(', ', $user->getDisallowedPasswordChars())); + Library::redirect(Library::getLink(array('view' => 'EditUser', 'userId' => $user->getId()))); } } Modified: branches/release-candidates/sciret-1.2/templates/EditUser.tpl =================================================================== --- branches/release-candidates/sciret-1.2/templates/EditUser.tpl 2007-08-19 13:12:37 UTC (rev 510) +++ branches/release-candidates/sciret-1.2/templates/EditUser.tpl 2007-08-19 13:13:15 UTC (rev 511) @@ -35,8 +35,12 @@ <td style="text-align:right">[l]Password[/l]: </td> <td><input type="password" name="password" value="{password}" /></td> </tr> + <tr class="row_on"> + <td style="text-align:right">[l]Repeat password[/l]: </td> + <td><input type="password" name="password2" value="{password2}" /></td> + </tr> <!-- BEGIN adminAccess_block --> - <tr class="row_on"> + <tr class="row_off"> <td style="text-align:right">[l]Give Admin access?[/l]: </td> <td><input type="checkbox" name="adminAccess" {checkedAdminAccess} /></td> </tr> Modified: branches/release-candidates/sciret-1.2/views/EditUser.php =================================================================== --- branches/release-candidates/sciret-1.2/views/EditUser.php 2007-08-19 13:12:37 UTC (rev 510) +++ branches/release-candidates/sciret-1.2/views/EditUser.php 2007-08-19 13:13:15 UTC (rev 511) @@ -34,6 +34,8 @@ 'lastName' => $user->getLastName(), 'userName' => $user->getUserName(), 'email' => $user->getEmail(), + 'password' => '', + 'password2' => '', 'checkedAdminAccess' => $user->isAdmin()? 'checked="true" ' : '', )); } else { @@ -44,6 +46,7 @@ 'userName' => isset($_SESSION['formFields']['userName'])? $_SESSION['formFields']['userName'] : '', 'email' => isset($_SESSION['formFields']['email'])? $_SESSION['formFields']['email'] : '', 'password' => isset($_SESSION['formFields']['password'])? $_SESSION['formFields']['password'] : '', + 'password2' => isset($_SESSION['formFields']['password'])? $_SESSION['formFields']['password'] : '', 'checkedAdminAccess' => (isset($_SESSION['formFields']['checkedAdminAccess']) && $_SESSION['formFields']['checkedAdminAccess'])? 'checked="true"' : '', )); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |