Exemplo n.º 1
0
 public function myAccount($request, $match)
 {
     // As the password is salted, we can directly take the sha1 of
     // the salted password.
     $api_key = sha1($request->user->password);
     $ext_pass = substr(sha1($request->user->password . Pluf::f('secret_key')), 0, 8);
     $params = array('user' => $request->user);
     if ($request->method == 'POST') {
         $form = new IDF_Form_UserAccount(array_merge((array) $request->POST, (array) $request->FILES), $params);
         if ($form->isValid()) {
             $user = $form->save();
             $url = Pluf_HTTP_URL_urlForView('IDF_Views_User::myAccount');
             $request->session->setData('pluf_language', $user->language);
             $request->user->setMessage(__('Your personal information has been updated.'));
             return new Pluf_HTTP_Response_Redirect($url);
         }
     } else {
         $data = $request->user->getData();
         unset($data['password']);
         $form = new IDF_Form_UserAccount(null, $params);
     }
     $keys = $request->user->get_idf_key_list();
     return Pluf_Shortcuts_RenderToResponse('idf/user/myaccount.html', array('page_title' => __('Your Account'), 'api_key' => $api_key, 'ext_pass' => $ext_pass, 'keys' => $keys, 'form' => $form), $request);
 }
Exemplo n.º 2
0
 public function clean_public_key()
 {
     $this->cleaned_data['public_key'] = IDF_Form_UserAccount::checkPublicKey($this->cleaned_data['public_key']);
     return $this->cleaned_data['public_key'];
 }
Exemplo n.º 3
0
 function clean_ssh_key()
 {
     return IDF_Form_UserAccount::checkSshKey($this->cleaned_data['ssh_key']);
 }