source: trunk/preferences/changepassword.php @ 2639

Revision 2639, 4.6 KB checked in by rafaelraymundo, 14 years ago (diff)

Ticket #1053 - Alterado o changepassword_default.php para não exibir header/navbar.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2        /**************************************************************************\
3        * phpGroupWare - preferences                                               *
4        * http://www.phpgroupware.org                                              *
5        * Written by Joseph Engo <jengo@phpgroupware.org>                          *
6        * --------------------------------------------                             *
7        *  This program is free software; you can redistribute it and/or modify it *
8        *  under the terms of the GNU General Public License as published by the   *
9        *  Free Software Foundation; either version 2 of the License, or (at your  *
10        *  option) any later version.                                              *
11        \**************************************************************************/
12
13
14        $GLOBALS['phpgw_info']['flags'] = array(
15                //'noheader'   => True,
16                //'nonavbar'   => True,
17                'currentapp' => 'preferences'
18        );
19
20        include('../header.inc.php');
21
22/*
23function path_template_include($app,$prefix)
24    {
25        $file_include = PHPGW_SERVER_ROOT . '/' . $app . '/templates/' . $GLOBALS['phpgw_info']['login_template_set'] . '/' . $prefix . '_' . $GLOBALS['phpgw_info']['login_template_set'] . '.php';
26
27        if(!$file_include || !file_exists($file_include))
28            {
29                $file_include = PHPGW_SERVER_ROOT . '/' . $app . '/templates/default/' . $prefix .'_default.php';
30            }
31
32        return $file_include;
33    }
34*/
35
36function grava_senha_criptografada_com_certificado_no_ldap($aux_uid,$aux_senha)
37   {
38        require_once('/var/www/expresso/security/classes/CertificadoB.php');
39        $ldap_context = $GLOBALS['phpgw_info']['server']['ldap_context'];
40        $ldap_servidor = $GLOBALS['phpgw_info']['server']['ldap_host'];
41        $ldap_dn = $GLOBALS['phpgw_info']['server']['ldap_root_dn'];
42        $ldap_passwd = $GLOBALS['phpgw_info']['server']['ldap_root_pw'];
43
44        $cc=ldap_connect($ldap_servidor);
45
46        //  bind ..
47        $sr=ldap_bind($cc,$ldap_dn,$ldap_passwd);
48
49        $filtro = 'uidNumber='.$aux_uid;
50
51        // Pesquisa uidNumber no LDAP
52        $sr=ldap_search($cc, $ldap_context,$filtro);
53
54        // Pega resultado ....
55        $info = ldap_get_entries($cc, $sr);
56
57        // Tem de achar só uma entrada.....ao menos uma....
58        if($info["count"]!=1)
59            {
60                ldap_close($cc);
61                return false;
62            }
63
64        if(!$info[0]["usercertificate"][0])
65            {
66                //Usuario sem certificado cadastrado
67                ldap_close($cc);
68                return false;
69            }
70
71        $a = new certificadoB();
72        $R = $a->encriptar_senha($aux_senha,$info[0]["usercertificate"][0]);
73        if(!$R)
74            {
75                return false;
76            }
77        $user_info = array();
78        $aux1 = $info[0]["dn"];
79        $user_info['cryptpassword'] = $R;
80        ldap_modify($cc,$aux1,$user_info);
81
82        ldap_close($cc);
83
84        return true;
85   }
86        $a_passwd   = $_POST['a_passwd'];
87        $n_passwd   = $_POST['n_passwd'];
88        $n_passwd_2 = $_POST['n_passwd_2'];
89
90        if(!$GLOBALS['phpgw']->acl->check('changepassword', 1) || $_POST['cancel'])
91        {
92                if(($GLOBALS['phpgw_info']['user']['lastpasswd_change'] == '0') && (!$_POST['cancel']))
93                        $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/login.php','cd=6'));
94
95                if ($GLOBALS['phpgw_info']['server']['use_https'] == 1)
96                        $GLOBALS[ 'phpgw' ] -> redirect_link( '/preferences/index.php' );
97                else
98                        $GLOBALS[ 'phpgw' ] -> redirect_link( '/preferences/index.php' );
99
100                $GLOBALS['phpgw']->common->phpgw_exit();
101        }
102
103        $GLOBALS['phpgw']->template->set_file(array(
104                'form' => 'changepassword.tpl'
105        ));
106        $GLOBALS['phpgw']->template->set_var('lang_enter_actual_password',lang('Enter your actual password'));
107        $GLOBALS['phpgw']->template->set_var('lang_enter_password',lang('Enter your new password'));
108        $GLOBALS['phpgw']->template->set_var('lang_reenter_password',lang('Re-enter your password'));
109        $GLOBALS['phpgw']->template->set_var('lang_change',lang('Change'));
110        $GLOBALS['phpgw']->template->set_var('lang_cancel',lang('Cancel'));
111        $GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/preferences/changepassword.php'));
112
113        if ($_GET['cd'] == 1)
114        {
115                $lang1 = lang('Your password has expired');
116                $lang2 = lang('You must register a new password');
117                $GLOBALS['phpgw']->template->set_var('messages',"<font color=red><h1>$lang1.<br>$lang2.</h1></font>");
118        }
119
120        if ($GLOBALS['phpgw_info']['server']['auth_type'] != 'ldap')
121        {
122                $GLOBALS['phpgw']->template->set_var('sql_message',lang('note: This feature does *not* change your email password. This will '
123                        . 'need to be done manually.'));
124        }
125
126        if ($_POST['change'])
127            {
128                include(personalize_include_path('preferences','changepassword'));
129            }
130        else
131        {
132                $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Change your password');
133
134                $GLOBALS['phpgw']->template->pfp('out','form');
135                $GLOBALS['phpgw']->common->phpgw_footer();
136        }
137?>
Note: See TracBrowser for help on using the repository browser.