Skip to content

Commit

Permalink
Update namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
daftspunk committed Jan 16, 2014
1 parent 2462d4d commit ecd4e94
Show file tree
Hide file tree
Showing 15 changed files with 50 additions and 49 deletions.
15 changes: 8 additions & 7 deletions Plugin.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php namespace Plugins\RainLab\User;
<?php namespace RainLab\User;

use Backend;
use Modules\System\Classes\PluginBase;
use System\Classes\PluginBase;
use October\Rain\Support\FacadeLoader;

class Plugin extends PluginBase
Expand All @@ -20,16 +20,17 @@ public function pluginDetails()
public function register()
{
$facade = FacadeLoader::instance();
$facade->facade('Auth', 'Plugins\RainLab\User\Facades\Auth');
$facade->facade('Auth', 'RainLab\User\Facades\Auth');
}

public function registerComponents()
{
return [
'Plugins\RainLab\User\Components\RegisterForm' => 'userRegisterForm',
'Plugins\RainLab\User\Components\SignInForm' => 'userSignInForm',
'Plugins\RainLab\User\Components\ResetForm' => 'userResetForm',
'Plugins\RainLab\User\Components\User' => 'user',
'RainLab\User\Components\RegisterForm' => 'userRegisterForm',
'RainLab\User\Components\SignInForm' => 'userSignInForm',
'RainLab\User\Components\ResetForm' => 'userResetForm',
'RainLab\User\Components\UpdateForm' => 'userUpdateForm',
'RainLab\User\Components\User' => 'user',
];
}

Expand Down
8 changes: 4 additions & 4 deletions classes/AuthManager.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php namespace Plugins\RainLab\User\Classes;
<?php namespace RainLab\User\Classes;

use October\Rain\Auth\Manager as RainAuthManager;

class AuthManager extends RainAuthManager
{
protected static $instance;

protected $userModel = 'Plugins\RainLab\User\Models\User';
protected $userModel = 'RainLab\User\Models\User';

// protected $groupModel = 'Plugins\RainLab\User\Models\Group';
// protected $groupModel = 'RainLab\User\Models\Group';

protected $throttleModel = 'Plugins\RainLab\User\Models\Throttle';
protected $throttleModel = 'RainLab\User\Models\Throttle';
}
4 changes: 2 additions & 2 deletions components/RegisterForm.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php namespace Plugins\RainLab\User\Components;
<?php namespace RainLab\User\Components;

use Auth;
use Input;
use Redirect;
use Validator;
use Modules\Cms\Classes\ComponentBase;
use Cms\Classes\ComponentBase;
use October\Rain\Support\ValidationException;

class RegisterForm extends ComponentBase
Expand Down
8 changes: 4 additions & 4 deletions components/ResetForm.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php namespace Plugins\RainLab\User\Components;
<?php namespace RainLab\User\Components;

use Auth;
use Mail;
use View;
use Validator;
use Modules\Cms\Classes\ComponentBase;
use Cms\Classes\ComponentBase;
use October\Rain\Support\ValidationException;
use Modules\System\Classes\ApplicationException;
use System\Classes\ApplicationException;

class ResetForm extends ComponentBase
{
Expand Down Expand Up @@ -88,7 +88,7 @@ public function onResetPassword()
throw new ValidationException(['code' => 'Invalid activation code supplied']);
}

public function getCode()
public function code()
{
$routeParameter = $this->property('code-param');
return $this->param($routeParameter);
Expand Down
4 changes: 2 additions & 2 deletions components/SignInForm.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php namespace Plugins\RainLab\User\Components;
<?php namespace RainLab\User\Components;

use Auth;
use Redirect;
use Validator;
use Modules\Cms\Classes\ComponentBase;
use Cms\Classes\ComponentBase;
use October\Rain\Support\ValidationException;

class SignInForm extends ComponentBase
Expand Down
26 changes: 13 additions & 13 deletions components/User.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php namespace Plugins\RainLab\User\Components;
<?php namespace RainLab\User\Components;

use Auth;
use Redirect;
use Modules\Cms\Classes\ComponentBase;
use Cms\Classes\ComponentBase;
use October\Rain\Support\ValidationException;

class User extends ComponentBase
Expand All @@ -21,17 +21,6 @@ public function defineProperties()
return [];
}

/**
* Returns the logged in user, if available
*/
public function active()
{
if (!Auth::check())
return null;

return Auth::getUser();
}

/**
* Log out the user
*
Expand All @@ -44,4 +33,15 @@ public function onLogout()
return Redirect::to('/');
}

/**
* Returns the logged in user, if available
*/
public function active()
{
if (!Auth::check())
return null;

return Auth::getUser();
}

}
4 changes: 2 additions & 2 deletions components/registerform/default.htm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<form
data-request="{{ __SELF__}}::onRegister">
<div class="form-group">
<label for="userRegisterName">Name</label>
<input name="name" type="text" class="form-control" id="userRegisterEmail" placeholder="Enter your name">
<label for="userRegisterName">Full Name</label>
<input name="name" type="text" class="form-control" id="userRegisterEmail" placeholder="Enter your full name">
</div>

<div class="form-group">
Expand Down
8 changes: 4 additions & 4 deletions controllers/Users.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php namespace Plugins\RainLab\User\Controllers;
<?php namespace RainLab\User\Controllers;

use Session;
use BackendMenu;
use BackendAuth;
use Modules\Backend\Classes\BackendController;
use Backend\Classes\BackendController;

class Users extends BackendController
{
public $implement = [
'Modules.Backend.Behaviors.FormController',
'Modules.Backend.Behaviors.ListController'
'Backend.Behaviors.FormController',
'Backend.Behaviors.ListController'
];

public $formConfig = 'form_config.yaml';
Expand Down
2 changes: 1 addition & 1 deletion controllers/users/form_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

name: User
form: /plugins/rainlab/user/models/user/form_fields.yaml
model-class: Plugins\RainLab\User\Models\User
model-class: RainLab\User\Models\User
default-redirect: rainlab/user/users

create:
Expand Down
2 changes: 1 addition & 1 deletion controllers/users/list_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

title: Manage Users
list: /plugins/rainlab/user/models/user/list_columns.yaml
model-class: Plugins\RainLab\User\Models\User
model-class: RainLab\User\Models\User
record-url: rainlab/user/users/update/:id
no-records-message: backend::lang.list.no_records
records-per-page: 5
Expand Down
4 changes: 2 additions & 2 deletions facades/Auth.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php namespace Plugins\RainLab\User\Facades;
<?php namespace RainLab\User\Facades;

use October\Rain\Support\Facade;

Expand All @@ -8,5 +8,5 @@ class Auth extends Facade
* Get the class name this facade is acting on behalf of.
* @return string
*/
protected static function getFacadeAccessor() { return 'Plugins\RainLab\User\Classes\AuthManager'; }
protected static function getFacadeAccessor() { return 'RainLab\User\Classes\AuthManager'; }
}
4 changes: 2 additions & 2 deletions models/Throttle.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php namespace Plugins\RainLab\User\Models;
<?php namespace RainLab\User\Models;

use October\Rain\Auth\Models\Throttle as ThrottleBase;

Expand All @@ -13,6 +13,6 @@ class Throttle extends ThrottleBase
* @var array Relations
*/
public $belongsTo = [
'user' => ['Plugins\RainLab\User\Models\User', 'foreignKey' => 'user_id']
'user' => ['RainLab\User\Models\User', 'foreignKey' => 'user_id']
];
}
6 changes: 3 additions & 3 deletions models/User.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php namespace Plugins\RainLab\User\Models;
<?php namespace RainLab\User\Models;

use October\Rain\Auth\Models\User as UserBase;

Expand All @@ -22,11 +22,11 @@ class User extends UserBase
* Relations
*/
// public $belongsToMany = [
// 'groups' => ['Plugins\RainLab\User\Models\Group', 'table' => 'user_groups']
// 'groups' => ['RainLab\User\Models\Group', 'table' => 'user_groups']
// ];

public $morphOne = [
'avatar' => ['Modules\System\Models\File', 'name' => 'attachment']
'avatar' => ['System\Models\File', 'name' => 'attachment']
];

/**
Expand Down
2 changes: 1 addition & 1 deletion updates/create_throttle_table.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php namespace Plugins\RainLab\User\Updates;
<?php namespace RainLab\User\Updates;

use Schema;
use October\Rain\Database\Updates\Migration;
Expand Down
2 changes: 1 addition & 1 deletion updates/create_users_table.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php namespace Plugins\RainLab\User\Updates;
<?php namespace RainLab\User\Updates;

use Schema;
use October\Rain\Database\Updates\Migration;
Expand Down

0 comments on commit ecd4e94

Please sign in to comment.