]> git.andy128k.dev Git - ipf.git/commitdiff
cleanup
authorAndrey Kutejko <andy128k@gmail.com>
Sat, 16 Aug 2014 07:02:13 +0000 (10:02 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 16 Aug 2014 08:08:39 +0000 (11:08 +0300)
ipf/auth/app.php
ipf/auth/forms/profile.php [deleted file]
ipf/auth/forms/usercreation.php [deleted file]
ipf/auth/middleware.php

index e0f5034e7e8567073bcddf375402e24b522dd45c..8c6f4a2036d76f9a2f15c3214d57b49040ae88a8 100644 (file)
@@ -19,7 +19,7 @@ class IPF_Auth_App extends IPF_Application
                 ),
         ));
     }
-    
+
     static function login($request, $user)
     {
         $request->user = $user;
@@ -158,7 +158,7 @@ class IPF_Auth_App extends IPF_Application
         foreach ($permissions as $permName=>&$permValue)
         {
             $permissionValue = $prefix.$permName;
-            
+
             foreach ($user_permissions as $user_permission_value)
             {
                 if ($permissionValue == $user_permission_value)
@@ -171,15 +171,15 @@ class IPF_Auth_App extends IPF_Application
 
         return $permissions;
     }
-    
+
     static function GetHumanNameOfPermission($permissionName)
     {
         $parts   = explode('|', $permissionName);
         $appName = $parts[0];
         $app     = new $appName();
         $admin   = IPF_Admin_Model::getModelAdmin($parts[1]);
-        
+
         return $app->getTitle().' | '.$admin->verbose_name().' | '.ucfirst($parts[2]);
-    }    
+    }
 }
 
diff --git a/ipf/auth/forms/profile.php b/ipf/auth/forms/profile.php
deleted file mode 100644 (file)
index b752536..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-class IPF_Auth_Forms_Profile extends IPF_Form_Model{
-    function __construct($data=null, $extra=array(), $label_suffix=null){
-        $extra['model'] = new User();
-        parent::__construct($data, $extra, $label_suffix);
-    }
-
-    function fields(){
-        return array('username','email','first_name','last_name');
-    }
-
-    function addDBField($name,$col){
-        parent::addDBField($name, $col);
-        if ($name=='username')
-            $this->fields['username']->help_text = 'Required. 32 characters or less. Alphanumeric characters only (letters, digits and underscores).';
-    }
-}
diff --git a/ipf/auth/forms/usercreation.php b/ipf/auth/forms/usercreation.php
deleted file mode 100644 (file)
index 5ca893b..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php 
-
-class IPF_Auth_Forms_UserCreation extends IPF_Form_Model{
-    function __construct($data=null, $extra=array(), $label_suffix=null){
-        $extra['model'] = new User();
-        parent::__construct($data, $extra, $label_suffix);
-    }
-    
-    function fields(){ 
-        return array('username','password1','password2','email','first_name','last_name','is_active','is_staff','is_superuser'); 
-    }
-    
-    function addDBField($name,$col){
-        parent::addDBField($name, $col);
-        if ($name=='username')
-            $this->fields['username']->help_text = 'Required. 32 characters or less. Alphanumeric characters only (letters, digits and underscores).';
-    }
-    
-    function add__password1__field(){
-        $this->fields['password1'] = new IPF_Form_Field_Varchar(array('label'=>'Password','required'=>true,'max_length'=>32,'widget'=>'IPF_Form_Widget_PasswordInput'));
-    }
-
-    function add__password2__field(){
-        $this->fields['password2'] = new IPF_Form_Field_Varchar(array('label'=>'Password (again)','required'=>true,'max_length'=>32,'widget'=>'IPF_Form_Widget_PasswordInput','help_text'=>'Enter the same password as above, for verification.'));
-    }
-    
-    function isValid(){
-        $ok = parent::isValid();
-        if ($ok===true){
-            if ($this->cleaned_data['password1']!=$this->cleaned_data['password2']){
-                $this->is_valid = false;
-                $this->errors['password2'][] = "The two password fields didn't match.";
-                return false;
-            }
-        }
-        return $ok;
-    }
-}
index 6f6f67664be6f0fb9bbf304e9bb243197ccfcc49..455403c7c6c07e46c2fa331d5f3fa5f1a9801abc 100644 (file)
@@ -7,7 +7,7 @@ class IPF_Auth_Middleware
     function processRequest($request)
     {
         $request->user = null;
-    
+
         $user_id = \PFF\Arr::get($request->session->data, self::SessionKey, 0);
         if ($user_id > 0) {
             $request->user = User::table()->find($user_id);