diff options
| author | bitweaver.org <bitweaver@users.sourceforge.net> | 2005-06-19 05:12:24 +0000 |
|---|---|---|
| committer | bitweaver.org <bitweaver@users.sourceforge.net> | 2005-06-19 05:12:24 +0000 |
| commit | 657b3b2cb4d1ecb68c78320bdc03151590a9e6cd (patch) | |
| tree | c88e26bedb5f01d457e28d07d6b7aa08ed13cdd1 /change_password.php | |
| download | users-657b3b2cb4d1ecb68c78320bdc03151590a9e6cd.tar.gz users-657b3b2cb4d1ecb68c78320bdc03151590a9e6cd.tar.bz2 users-657b3b2cb4d1ecb68c78320bdc03151590a9e6cd.zip | |
IMPORT TikiPro CLYDE FINAL
Diffstat (limited to 'change_password.php')
| -rw-r--r-- | change_password.php | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/change_password.php b/change_password.php new file mode 100644 index 0000000..0108560 --- /dev/null +++ b/change_password.php @@ -0,0 +1,54 @@ +<?php +// $Header: /cvsroot/bitweaver/_bit_users/change_password.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $ +// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. +// All Rights Reserved. See copyright.txt for details and a complete list of authors. +// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. +// Initialization +require_once( '../bit_setup_inc.php' ); +if (!isset($_REQUEST['login'])) + $_REQUEST['login'] = ''; +if (!isset($_REQUEST["oldpass"])) + $_REQUEST["oldpass"] = ''; +$smarty->assign('login', $_REQUEST['login']); +$smarty->assign('oldpass', $_REQUEST["oldpass"]); +if (isset($_REQUEST["change"])) { + + if ($_REQUEST["pass"] != $_REQUEST["pass2"]) { + $smarty->assign('msg', tra("The passwords didn't match")); + $gBitSystem->display( 'error.tpl' ); + die; + } + if ($_REQUEST["pass"] == $_REQUEST["oldpass"]) { + $smarty->assign('msg', tra("You can not use the same password again")); + $gBitSystem->display( 'error.tpl' ); + die; + } + if (!$gBitUser->validate_user($_REQUEST['login'], $_REQUEST["oldpass"], '', '')) { + if(!$gBitUser->validate_user("admin",substr($_REQUEST["oldpass"],6,200),'','') or (!$gBitUser->isAdmin())) { + $smarty->assign('msg', tra("Invalid old password")); + $gBitSystem->display( 'error.tpl' ); + die; + } + } + //Validate password here + if (strlen($_REQUEST["pass"]) < $min_pass_length) { + $smarty->assign('msg', tra("Password should be at least"). ' ' . $min_pass_length . ' ' . tra("characters long")); + $gBitSystem->display( 'error.tpl' ); + die; + } + // Check this code + if ($pass_chr_num == 'y') { + if (!preg_match_all("/[0-9]+/", $_REQUEST["pass"], $foo) || !preg_match_all("/[A-Za-z]+/", $_REQUEST["pass"], $foo)) { + $smarty->assign('msg', tra("Password must contain both letters and numbers")); + $gBitSystem->display( 'error.tpl' ); + die; + } + } + $gBitUser->change_user_password($_REQUEST['login'], $_REQUEST["pass"]); + $url = $gBitUser->login( $_REQUEST['login'], $_REQUEST["pass"] ); + header ( "location: ".$url ); +} + +// Display the template +$gBitSystem->display( 'bitpackage:users/change_password.tpl'); +?> |
