Commit 5a2705d6 authored by Nicolas Widart's avatar Nicolas Widart

Merging the session module in the user module

parent 2bf4408d
<?php namespace Modules\User\Commands;
class BeginResetProcessCommand
{
public $email;
public function __construct($email)
{
$this->email = $email;
}
}
\ No newline at end of file
<?php namespace Modules\User\Commands;
use Cartalyst\Sentinel\Laravel\Facades\Reminder;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Illuminate\Support\Facades\Event;
use Laracasts\Commander\CommandHandler;
use Modules\User\Events\UserHasBegunResetProcess;
use Modules\User\Exceptions\UserNotFoundException;
class BeginResetProcessCommandHandler implements CommandHandler
{
/**
* Handle the command
*
* @param $command
* @throws UserNotFoundException
* @return mixed
*/
public function handle($command)
{
$user = $this->findUser((array) $command);
$reminder = Reminder::exists($user) ?: Reminder::create($user);
Event::fire('Modules.Session.Events.UserHasBegunResetProcess', new UserHasBegunResetProcess($user, $reminder));
}
private function findUser($credentials)
{
$user = Sentinel::findByCredentials((array) $credentials);
if ($user) {
return $user;
}
throw new UserNotFoundException();
}
}
\ No newline at end of file
<?php namespace Modules\User\Commands;
class CompleteResetProcessCommand
{
public $password_confirmation;
public $password;
public $userId;
public $code;
public function __construct($password, $password_confirmation, $userId, $code)
{
$this->password_confirmation = $password_confirmation;
$this->password = $password;
$this->userId = $userId;
$this->code = $code;
}
}
\ No newline at end of file
<?php namespace Modules\User\Commands;
use Cartalyst\Sentinel\Laravel\Facades\Reminder;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Laracasts\Commander\CommandHandler;
use Modules\User\Exceptions\UserNotFoundException;
class CompleteResetProcessCommandHandler implements CommandHandler
{
protected $input;
/**
* Handle the command
*
* @param $command
* @throws InvalidOrExpiredResetCode
* @throws UserNotFoundException
* @return mixed
*/
public function handle($command)
{
$this->input = $command;
$this->form->validate((array) $this->input);
$user = $this->findUser();
if (!Reminder::complete($user, $this->input->code, $this->input->password)) {
throw new InvalidOrExpiredResetCode;
}
return $user;
}
public function findUser()
{
$user = Sentinel::findById($this->input->userId);
if ($user) {
return $user;
}
throw new UserNotFoundException;
}
}
\ No newline at end of file
<?php namespace Modules\User\Commands;
class RegisterNewUserCommand
{
public $email;
public $password;
public $password_confirmation;
public function __construct($email, $password, $password_confirmation)
{
$this->email = $email;
$this->password = $password;
$this->password_confirmation = $password_confirmation;
}
}
\ No newline at end of file
<?php namespace Modules\User\Commands;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Illuminate\Support\Facades\Event;
use Laracasts\Commander\CommandHandler;
use Modules\User\Events\UserHasRegistered;
class RegisterNewUserCommandHandler implements CommandHandler
{
protected $input;
/**
* Handle the command
*
* @param $input
* @return mixed
*/
public function handle($input)
{
$this->input = $input;
$user = $this->createUser();
$this->assignUserToUsersGroup($user);
Event::fire('Modules.Session.Events.UserHasRegistered', new UserHasRegistered($user));
return $user;
}
private function createUser()
{
return Sentinel::getUserRepository()->create((array) $this->input);
}
private function assignUserToUsersGroup($user)
{
$group = Sentinel::findRoleByName('User');
$group->users()->attach($user);
}
}
\ No newline at end of file
<?php namespace Modules\User\Database\Seeders;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class SentryGroupSeedTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$groups = Sentinel::getRoleRepository();
// Create an Admin group
$groups->createModel()->create(
[
'name' => 'Admin',
'slug' => 'admin',
]
);
// Create an Users group
$groups->createModel()->create(
[
'name' => 'User',
'slug' => 'user',
]
);
// Save the permissions
$group = Sentinel::findRoleBySlug('admin');
$group->permissions = [
'dashboard.index' => true,
'workbench.index' => true,
'workbench.generate' => true,
'workbench.migrate' => true,
'workbench.install' => true,
'workbench.seed' => true,
'modules.index' => true,
'modules.store' => true,
];
$group->save();
$group = Sentinel::findRoleBySlug('user');
$group->permissions = [
'dashboard.index' => true
];
$group->save();
}
}
\ No newline at end of file
<?php namespace Modules\User\Database\Seeders;
use Cartalyst\Sentinel\Laravel\Facades\Activation;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class SentryUserSeedTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
// Create an admin user
$user = Sentinel::create(
[
'email' => 'n.widart@gmail.com',
'password' => 'test',
'first_name' => 'Nicolas',
'last_name' => 'Widart'
]
);
// Activate the admin directly
$activation = Activation::create($user);
Activation::complete($user, $activation->code);
// Find the group using the group id
$adminGroup = Sentinel::findRoleBySlug('admin');
// Assign the group to the user
$adminGroup->users()->attach($user);
}
}
\ No newline at end of file
<?php namespace Modules\Users\Database\Seeders;
<?php namespace Modules\User\Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class UsersDatabaseSeeder extends Seeder {
class UsersDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
......@@ -14,7 +14,8 @@ class UsersDatabaseSeeder extends Seeder {
{
Model::unguard();
// $this->call("OthersTableSeeder");
$this->call("Modules\\Session\\Database\\Seeders\\SentryGroupSeedTableSeeder");
$this->call("Modules\\Session\\Database\\Seeders\\SentryUserSeedTableSeeder");
}
}
\ No newline at end of file
<?php namespace Modules\User\Entities;
use Cartalyst\Sentinel\Users\EloquentUser as SentryUser;
use Laracasts\Presenter\PresentableTrait;
class User extends SentryUser
{
use PresentableTrait;
protected $fillable = [
'email',
'password',
'permissions',
'first_name',
'last_name'
];
protected $presenter = 'Modules\Session\Presenters\UserPresenter';
}
<?php namespace Modules\User\Events;
class UserHasBegunResetProcess
{
public $user;
public $reminder;
public function __construct($user, $reminder)
{
$this->user = $user;
$this->reminder = $reminder;
}
}
\ No newline at end of file
<?php namespace Modules\User\Events;
class UserHasRegistered
{
public $user;
public function __construct($user)
{
$this->user = $user;
}
}
\ No newline at end of file
<?php namespace Modules\User\Exceptions;
use Exception;
class InvalidOrExpiredResetCode extends Exception
{
}
\ No newline at end of file
<?php namespace Modules\User\Exceptions;
use Exception;
class UserNotFoundException extends Exception
{
}
\ No newline at end of file
<?php namespace Modules\User\Http\Controllers;
use Cartalyst\Sentinel\Checkpoints\NotActivatedException;
use Cartalyst\Sentinel\Checkpoints\ThrottlingException;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View;
use Laracasts\Commander\CommanderTrait;
use Laracasts\Flash\Flash;
use Modules\User\Exceptions\InvalidOrExpiredResetCode;
use Modules\User\Exceptions\UserNotFoundException;
use Modules\User\Http\Requests\LoginRequest;
use Modules\User\Http\Requests\RegisterRequest;
use Modules\User\Http\Requests\ResetCompleteRequest;
use Modules\User\Http\Requests\ResetRequest;
/**
* @Controller()
* @Before("auth.guest", on={"getLogin", "getRegister"})
*/
class AuthController
{
use CommanderTrait;
public function __construct()
{
}
public function getLogin()
{
return View::make('user::public.login');
}
public function postLogin(LoginRequest $request)
{
$credentials = [
'email' => $request->email,
'password' => $request->password
];
$remember = (bool)$request->get('remember_me', false);
try {
if ($user = Sentinel::authenticate($credentials, $remember)) {
Flash::success('Successfully logged in.');
return Redirect::route('dashboard.index', compact('user'));
}
Flash::error('Invalid login or password.');
} catch (NotActivatedException $e) {
Flash::error('Account not yet validated. Please check your email.');
} catch (ThrottlingException $e) {
$delay = $e->getDelay();
Flash::error("Your account is blocked for {$delay} second(s).");
}
return Redirect::back()->withInput();
}
public function getRegister()
{
return View::make('session::public.register');
}
public function postRegister(RegisterRequest $request)
{
$this->execute('Modules\User\Commands\RegisterNewUserCommand', $request->all());
Flash::success('Account created. Please check your email to activate your account.');
return Redirect::route('register');
}
public function getLogout()
{
Sentinel::logout();
return Redirect::route('login');
}
public function getReset()
{
return View::make('user::public.reset.begin');
}
public function postReset(ResetRequest $request)
{
try {
$this->execute('Modules\User\Commands\BeginResetProcessCommand', $request->all());
} catch (UserNotFoundException $e) {
Flash::error('No user with that email address belongs in our system.');
return Redirect::back()->withInput();
}
Flash::success('Check your email to reset your password.');
return Redirect::route('reset');
}
public function getResetComplete()
{
return View::make('user::public.reset.complete');
}
public function postResetComplete($userId, $code, ResetCompleteRequest $request)
{
try {
$this->execute(
'Modules\User\Commands\CompleteResetProcessCommand',
array_merge($request->all(), ['userId' => $userId, 'code' => $code])
);
} catch (UserNotFoundException $e) {
Flash::error('The user no longer exists.');
return Redirect::back()->withInput();
} catch(InvalidOrExpiredResetCode $e) {
Flash::error('Invalid or expired reset code.');
return Redirect::back()->withInput();
}
Flash::success('Password has been reset. You can now login with your new password.');
return Redirect::route('login');
}
}
\ No newline at end of file
<?php namespace Modules\User\Http\Filters;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Illuminate\Support\Facades\Redirect;
class GuestFilter
{
public function filter()
{
if (Sentinel::check()) {
return Redirect::route('dashboard.index');
}
}
}
\ No newline at end of file
<?php namespace Modules\User\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class LoginRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required',
'password' => 'required',
];
}
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
public function messages()
{
return [];
}
}
\ No newline at end of file
<?php namespace Modules\User\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class RegisterRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required|email|unique:users',
'password' => 'required|confirmed|min:3',
];
}
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
public function messages()
{
return [];
}
}
\ No newline at end of file
<?php namespace Modules\User\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ResetCompleteRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'password' => 'required|min:3|confirmed',
'password_confirmation' => 'required'
];
}
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
public function messages()
{
return [];
}
}
\ No newline at end of file
<?php namespace Modules\User\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ResetRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required|email',
];
}
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
public function messages()
{
return [];
}
}
\ No newline at end of file
......@@ -22,3 +22,22 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'before' => 'Laravel
]]);
});
});
Route::group(['prefix' => 'auth', 'namespace' => 'Modules\User\Http\Controllers'], function()
{
# Login
Route::get('login', ['before' => 'auth.guest', 'as' => 'login', 'uses' => 'AuthController@getLogin']);
Route::post('login', array('as' => 'login.post', 'uses' => 'AuthController@postLogin'));
# Register
Route::get('register', ['before' => 'auth.guest', 'as' => 'register', 'uses' => 'AuthController@getRegister']);
Route::post('register', array('as' => 'register.post', 'uses' => 'AuthController@postRegister'));
# Account Activation
Route::get('activate/{userId}/{activationCode}', 'AuthController@getActivate');
# Reset password
Route::get('reset', ['as' => 'reset', 'uses' => 'AuthController@getReset']);
Route::post('reset', ['as' => 'reset.post', 'uses' => 'AuthController@postReset']);
Route::get('reset/{id}/{code}', ['as' => 'reset.complete', 'uses' => 'AuthController@getResetComplete']);
Route::post('reset/{id}/{code}', ['as' => 'reset.complete.post', 'uses' => 'AuthController@postResetComplete']);
# Logout
Route::get('logout', array('as' => 'logout', 'uses' => 'AuthController@getLogout'));
});
<?php namespace Modules\User\Listeners;
use Cartalyst\Sentinel\Laravel\Facades\Activation;
use Illuminate\Support\Facades\Mail;
use Laracasts\Commander\Events\EventListener;
class SendRegistrationConfirmationEmail extends EventListener
{
public function whenUserHasRegistered($event)
{
$user = $event->user;
$activation = Activation::create($user);
$data = [
'user' => $user,
'activationcode' => $activation->code
];
Mail::queue('session::emails.welcome',$data,
function ($m) use ($user) {
$m->to($user->email)->subject('Welcome.');
}
);
}
}
<?php namespace Modules\User\Listeners;
use Illuminate\Support\Facades\Mail;
use Laracasts\Commander\Events\EventListener;
class SendResetCodeEmail extends EventListener
{
public function whenUserHasBegunResetProcess($event)
{
$user = $event->user;
$code = $event->reminder->code;
Mail::queue('SessionModule::emails.reminder', compact('user', 'code'), function($m) use ($user)
{
$m->to($user->email)->subject('Reset your account password.');
});
}
}
\ No newline at end of file
<?php namespace Modules\User\Presenters;
use Laracasts\Presenter\Presenter;
class UserPresenter extends Presenter
{
/**
* Return the gravatar link for the users email
* @param int $size
* @return string
*/
public function gravatar($size = 90)
{
$email = md5($this->email);
return "//www.gravatar.com/avatar/$email?s=$size";
}
public function fullname()
{
return $this->first_name . ' ' . $this->last_name;
}
}
\ No newline at end of file
......@@ -21,6 +21,9 @@ class UserServiceProvider extends ServiceProvider
protected $filters = [
'Core' => [
'permissions' => 'PermissionFilter'
],
'User' => [
'auth.guest' => 'GuestFilter'
]
];
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>SocialDashy - Reset password</title>
<style type="text/css">
img {
max-width: 100%;
}
body {
-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; line-height: 1.6;
}
body {
background-color: #f6f6f6;
}
@media only screen and (max-width: 640px) {
h1 {
font-weight: 600 !important; margin: 20px 0 5px !important;
}
h2 {
font-weight: 600 !important; margin: 20px 0 5px !important;
}
h3 {
font-weight: 600 !important; margin: 20px 0 5px !important;
}
h4 {
font-weight: 600 !important; margin: 20px 0 5px !important;
}
h1 {
font-size: 22px !important;
}
h2 {
font-size: 18px !important;
}
h3 {
font-size: 16px !important;
}
.container {
width: 100% !important;
}
.content {
padding: 10px !important;
}
.content-wrapper {
padding: 10px !important;
}
.invoice {
width: 100% !important;
}
}
</style>
</head>
<body style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; line-height: 1.6; background: #f6f6f6; margin: 0; padding: 0;">
<table class="body-wrap" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; background: #f6f6f6; margin: 0; padding: 0;">
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0;" valign="top"></td>
<td class="container" width="600" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; display: block !important; max-width: 600px !important; clear: both !important; margin: 0 auto; padding: 0;" valign="top">
<div class="content" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; max-width: 600px; display: block; margin: 0 auto; padding: 20px;">
<table class="main" width="100%" cellpadding="0" cellspacing="0" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; border-radius: 3px; background: #fff; margin: 0; padding: 0; border: 1px solid #e9e9e9;">
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
<td class="content-wrap" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 20px;" valign="top">
<table width="100%" cellpadding="0" cellspacing="0" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
<td class="content-block" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 20px; font-weight:bold; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
SocialDashy - Password Reset
</td>
</tr>
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
<td class="content-block" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
To reset your password, complete this form: {{ URL::to("reset/{$user['id']}/{$code}") }}.
</td>
</tr>
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
<td class="content-block" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
<a href='{{ URL::to("reset/{$user['id']}/{$code}") }}' class="btn-primary" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; color: #FFF; text-decoration: none; line-height: 2; font-weight: bold; text-align: center; cursor: pointer; display: inline-block; border-radius: 5px; text-transform: capitalize; background: #348eda; margin: 0; padding: 0; border-color: #348eda; border-style: solid; border-width: 10px 20px;">Reset Password</a>
</td>
</tr>
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
<td class="content-block" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
&mdash; The SocialDashy team
</td>
</tr>
</table>
</td>
</tr>
</table>
<div class="footer" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; clear: both; color: #999; margin: 0; padding: 20px;">
<table width="100%" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
</table>
</div></div>
</td>
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0;" valign="top"></td>
</tr>
</table>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Welcome</title>
<style type="text/css">
img {
max-width: 100%;
}
body {
-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; line-height: 1.6;
}
body {
background-color: #f6f6f6;
}
@media only screen and (max-width: 640px) {
h1 {
font-weight: 600 !important; margin: 20px 0 5px !important;
}
h2 {
font-weight: 600 !important; margin: 20px 0 5px !important;
}
h3 {
font-weight: 600 !important; margin: 20px 0 5px !important;
}
h4 {
font-weight: 600 !important; margin: 20px 0 5px !important;
}
h1 {
font-size: 22px !important;
}
h2 {
font-size: 18px !important;
}
h3 {
font-size: 16px !important;
}
.container {
width: 100% !important;
}
.content {
padding: 10px !important;
}
.content-wrapper {
padding: 10px !important;
}
.invoice {
width: 100% !important;
}
}
</style>
</head>
<body style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; line-height: 1.6; background: #f6f6f6; margin: 0; padding: 0;">
<table class="body-wrap" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; background: #f6f6f6; margin: 0; padding: 0;">
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0;" valign="top"></td>
<td class="container" width="600" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; display: block !important; max-width: 600px !important; clear: both !important; margin: 0 auto; padding: 0;" valign="top">
<div class="content" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; max-width: 600px; display: block; margin: 0 auto; padding: 20px;">
<table class="main" width="100%" cellpadding="0" cellspacing="0" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; border-radius: 3px; background: #fff; margin: 0; padding: 0; border: 1px solid #e9e9e9;">
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
<td class="content-wrap" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 20px;" valign="top">
<table width="100%" cellpadding="0" cellspacing="0" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
<td class="content-block" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 20px; font-weight:bold; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
Welcome
</td>
</tr>
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
<td class="content-block" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
Please confirm your email address by clicking the link below.
</td>
</tr>
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
<td class="content-block" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
We may need to send you critical information about our service and it is important that we have an accurate email address.
</td>
</tr>
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
<td class="content-block" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
<a href="{{ URL::to('activate/' . $user['id'] . '/' . $activationcode) }}" class="btn-primary" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; color: #FFF; text-decoration: none; line-height: 2; font-weight: bold; text-align: center; cursor: pointer; display: inline-block; border-radius: 5px; text-transform: capitalize; background: #348eda; margin: 0; padding: 0; border-color: #348eda; border-style: solid; border-width: 10px 20px;">Confirm email address</a>
</td>
</tr>
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
<td class="content-block" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
&mdash; The team,
</td>
</tr>
</table>
</td>
</tr>
</table>
<div class="footer" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; clear: both; color: #999; margin: 0; padding: 20px;">
<table width="100%" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
</table>
</div></div>
</td>
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0;" valign="top"></td>
</tr>
</table>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html class="bg-black">
<head>
<meta charset="UTF-8">
<title>
@section('title')
Website
@show
</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<!-- bootstrap 3.0.2 -->
<link href="{{{ core_asset('css/vendor/bootstrap.min.css') }}}" rel="stylesheet" type="text/css" />
<!-- font Awesome -->
<link href="{{{ core_asset('css/vendor/font-awesome.min.css') }}}" rel="stylesheet" type="text/css" />
<!-- Ionicons -->
<link href="{{{ core_asset('css/vendor/ionicons.min.css') }}}" rel="stylesheet" type="text/css" />
<!-- Theme style -->
<link href="{{{ core_asset('css/AdminLTE.css') }}}" rel="stylesheet" type="text/css" />
<link href="{{{ core_asset('css/vendor/alertify/alertify.core.css') }}}" rel="stylesheet" type="text/css" />
<link href="{{{ core_asset('css/vendor/alertify/alertify.default.css') }}}" rel="stylesheet" type="text/css" />
<script src="{{{ core_asset('js/vendor/jquery.min.js') }}}"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
</head>
<body class="bg-black">
<div class="form-box" id="login-box">
@yield('content')
</div>
<!-- Bootstrap -->
<script src="{{{ core_asset('js/vendor/bootstrap.min.js') }}}" type="text/javascript"></script>
<script src="{{{ core_asset('js/vendor/alertify/alertify.js') }}}" type="text/javascript"></script>
</body>
</html>
\ No newline at end of file
@extends('user::layouts.account')
@section('title')
Login | @parent
@stop
@section('content')
<div class="header">Sign In</div>
@include('flash::message')
{!! Form::open(array('route' => 'login.post')) !!}
<div class="body bg-gray">
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<input type="email" name="email" class="form-control"
placeholder="Email" value="{{ Input::old('email')}}"/>
{!! $errors->first('email', '<span class="help-block">:message</span>') !!}
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<input type="password" name="password"
class="form-control" placeholder="Password"
value="{{ Input::old('password')}}"/>
{!! $errors->first('password', '<span class="help-block">:message</span>') !!}
</div>
<div class="form-group">
<input type="checkbox" name="remember_me" id="remember_me"/> <label for="remember_me">Remember me</label>
</div>
</div>
<div class="footer">
<button type="submit" class="btn bg-olive btn-block">Sign me in</button>
<p><a href="{{URL::route('reset')}}">I forgot my password</a></p>
<a href="{{URL::route('register')}}" class="text-center">Register a new membership</a>
</div>
</form>
@stop
\ No newline at end of file
@extends('user::layouts.account')
@section('title')
Register | @parent
@stop
@section('content')
<div class="header">Register New Membership</div>
@include('flash::message')
{!! Form::open(array('route' => 'register.post')) !!}
<div class="body bg-gray">
<div class="form-group{{ $errors->has('email') ? ' has-error has-feedback' : '' }}">
{!! Form::label('email', 'Email:') !!}
{!! Form::text('email', Input::old('email'), ['class' => 'form-control', 'placeholder' => 'Email']) !!}
{!! $errors->first('email', '<span class="help-block">:message</span>') !!}
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error has-feedback' : '' }}">
{!! Form::label('password', 'Password:') !!}
{!! Form::password('password', ['class' => 'form-control', 'placeholder' => 'Password']) !!}
{!! $errors->first('password', '<span class="help-block">:message</span>') !!}
</div>
<div class="form-group{{ $errors->has('password_confirmation') ? ' has-error has-feedback' : '' }}">
{!! Form::label('password_confirmation', 'Password Confirmation:') !!}
{!! Form::password('password_confirmation', ['class' => 'form-control', 'placeholder' => 'Password Confirmation']) !!}
{!! $errors->first('password_confirmation', '<span class="help-block">:message</span>') !!}
</div>
</div>
<div class="footer">
<button type="submit" class="btn bg-olive btn-block">Sign me up</button>
<a href="{{ URL::route('login') }}" class="text-center">I already have a membership</a>
</div>
{!! Form::close() !!}
@stop
\ No newline at end of file
@extends('session::layouts.account')
@section('title')
Reset password | @parent
@stop
@section('content')
<div class="header">Reset Password</div>
@include('flash::message')
{!! Form::open(array('route' => 'reset.post')) !!}
<div class="body bg-gray">
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<input type="email" name="email" class="form-control"
placeholder="Email" value="{{ Input::old('email')}}" required=""/>
{!! $errors->first('email', '<span class="help-block">:message</span>') !!}
</div>
</div>
<div class="footer">
<button type="submit" class="btn bg-olive btn-block">Reset</button>
<p><a href="{{URL::route('login')}}">I remembered my password.</a></p>
</div>
{!! Form::close(); !!}
@stop
\ No newline at end of file
@extends('session::layouts.account')
@section('title')
Reset password | @parent
@stop
@section('content')
<div class="header">Reset Password</div>
@include('flash::message')
{!! Form::open() !!}
<div class="body bg-gray">
<div class="form-group{{ $errors->has('password') ? ' has-error has-feedback' : '' }}">
{!! Form::label('password', 'Password:') !!}
{!! Form::password('password', ['class' => 'form-control', 'placeholder' => 'Password']) !!}
{!! $errors->first('password', '<span class="help-block">:message</span>') !!}
</div>
<div class="form-group{{ $errors->has('password_confirmation') ? ' has-error has-feedback' : '' }}">
{!! Form::label('password_confirmation', 'Password Confirmation:') !!}
{!! Form::password('password_confirmation', ['class' => 'form-control', 'placeholder' => 'Password Confirmation']) !!}
{!! $errors->first('password_confirmation', '<span class="help-block">:message</span>') !!}
</div>
</div>
<div class="footer">
<button type="submit" class="btn bg-olive btn-block">Reset</button>
</div>
{!! Form::close(); !!}
@stop
\ No newline at end of file
<?php
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
if (Module::active('User')) {
View::composer('core::partials.sidebar-nav', 'Modules\User\Composers\SidebarViewComposer');
}
View::composer('core::partials.sidebar-nav', 'Modules\User\Composers\SidebarViewComposer');
View::composer([
'user::admin.roles.partials.permissions',
'user::admin.roles.partials.permissions-create',
'user::admin.users.partials.permissions',
'user::admin.users.partials.permissions-create',
], 'Modules\User\Composers\PermissionsViewComposer');
View::composer(['core::partials.sidebar-nav', 'core::partials.top-nav'], function($view)
{
$view->with('user', Sentinel::check());
});
<?php
Event::listen('Modules.User.Events.*', 'Modules\User\Listeners\SendResetCodeEmail');
Event::listen('Modules.User.Events.*', 'Modules\User\Listeners\SendRegistrationConfirmationEmail');
\ No newline at end of file
......@@ -28,3 +28,4 @@ Config::addNamespace('user', __DIR__ . '/Config/');
require __DIR__ . '/Http/routes.php';
require __DIR__ . '/composers.php';
require __DIR__ . '/helpers.php';
require __DIR__ . '/listeners.php';
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment