Skip to content

Commit cbee7a0

Browse files
committed
first upload
login example. server side - using php&laravel in server side. client side - vue.js vue-router, and flux implementation that called "states management", with vuex.
1 parent b704108 commit cbee7a0

File tree

98 files changed

+16854
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+16854
-0
lines changed

.babelrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["es2015","react"]
3+
4+
}

.env.example

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
APP_ENV=local
2+
APP_KEY=
3+
APP_DEBUG=true
4+
APP_LOG_LEVEL=debug
5+
APP_URL=http://localhost
6+
7+
DB_CONNECTION=mysql
8+
DB_HOST=127.0.0.1
9+
DB_PORT=3306
10+
DB_DATABASE=homestead
11+
DB_USERNAME=homestead
12+
DB_PASSWORD=secret
13+
14+
BROADCAST_DRIVER=log
15+
CACHE_DRIVER=file
16+
SESSION_DRIVER=file
17+
QUEUE_DRIVER=sync
18+
19+
REDIS_HOST=127.0.0.1
20+
REDIS_PASSWORD=null
21+
REDIS_PORT=6379
22+
23+
MAIL_DRIVER=smtp
24+
MAIL_HOST=mailtrap.io
25+
MAIL_PORT=2525
26+
MAIL_USERNAME=null
27+
MAIL_PASSWORD=null
28+
MAIL_ENCRYPTION=null
29+
30+
PUSHER_APP_ID=
31+
PUSHER_KEY=
32+
PUSHER_SECRET=

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/node_modules
2+
/public/storage
3+
/storage/*.key
4+
/vendor
5+
/.idea
6+
Homestead.json
7+
Homestead.yaml
8+
.env

app/Console/Kernel.php

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace App\Console;
4+
5+
use Illuminate\Console\Scheduling\Schedule;
6+
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
7+
8+
class Kernel extends ConsoleKernel
9+
{
10+
/**
11+
* The Artisan commands provided by your application.
12+
*
13+
* @var array
14+
*/
15+
protected $commands = [
16+
//
17+
];
18+
19+
/**
20+
* Define the application's command schedule.
21+
*
22+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
23+
* @return void
24+
*/
25+
protected function schedule(Schedule $schedule)
26+
{
27+
// $schedule->command('inspire')
28+
// ->hourly();
29+
}
30+
31+
/**
32+
* Register the Closure based commands for the application.
33+
*
34+
* @return void
35+
*/
36+
protected function commands()
37+
{
38+
require base_path('routes/console.php');
39+
}
40+
}

app/Exceptions/Handler.php

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
3+
namespace App\Exceptions;
4+
5+
use Exception;
6+
use Illuminate\Auth\AuthenticationException;
7+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
8+
9+
class Handler extends ExceptionHandler
10+
{
11+
/**
12+
* A list of the exception types that should not be reported.
13+
*
14+
* @var array
15+
*/
16+
protected $dontReport = [
17+
\Illuminate\Auth\AuthenticationException::class,
18+
\Illuminate\Auth\Access\AuthorizationException::class,
19+
\Symfony\Component\HttpKernel\Exception\HttpException::class,
20+
\Illuminate\Database\Eloquent\ModelNotFoundException::class,
21+
\Illuminate\Session\TokenMismatchException::class,
22+
\Illuminate\Validation\ValidationException::class,
23+
];
24+
25+
/**
26+
* Report or log an exception.
27+
*
28+
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
29+
*
30+
* @param \Exception $exception
31+
* @return void
32+
*/
33+
public function report(Exception $exception)
34+
{
35+
parent::report($exception);
36+
}
37+
38+
/**
39+
* Render an exception into an HTTP response.
40+
*
41+
* @param \Illuminate\Http\Request $request
42+
* @param \Exception $exception
43+
* @return \Illuminate\Http\Response
44+
*/
45+
public function render($request, Exception $exception)
46+
{
47+
return parent::render($request, $exception);
48+
}
49+
50+
/**
51+
* Convert an authentication exception into an unauthenticated response.
52+
*
53+
* @param \Illuminate\Http\Request $request
54+
* @param \Illuminate\Auth\AuthenticationException $exception
55+
* @return \Illuminate\Http\Response
56+
*/
57+
protected function unauthenticated($request, AuthenticationException $exception)
58+
{
59+
if ($request->expectsJson()) {
60+
return response()->json(['error' => 'Unauthenticated.'], 401);
61+
}
62+
63+
return redirect()->guest('login');
64+
}
65+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
7+
8+
class ForgotPasswordController extends Controller
9+
{
10+
/*
11+
|--------------------------------------------------------------------------
12+
| Password Reset Controller
13+
|--------------------------------------------------------------------------
14+
|
15+
| This controller is responsible for handling password reset emails and
16+
| includes a trait which assists in sending these notifications from
17+
| your application to your users. Feel free to explore this trait.
18+
|
19+
*/
20+
21+
use SendsPasswordResetEmails;
22+
23+
/**
24+
* Create a new controller instance.
25+
*
26+
* @return void
27+
*/
28+
public function __construct()
29+
{
30+
$this->middleware('guest');
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use Illuminate\Foundation\Auth\AuthenticatesUsers;
7+
use Illuminate\Support\Facades\Auth;
8+
9+
class LoginController extends Controller
10+
{
11+
/*
12+
|--------------------------------------------------------------------------
13+
| Login Controller
14+
|--------------------------------------------------------------------------
15+
|
16+
| This controller handles authenticating users for the application and
17+
| redirecting them to your home screen. The controller uses a trait
18+
| to conveniently provide its functionality to your applications.
19+
|
20+
*/
21+
22+
use AuthenticatesUsers;
23+
24+
/**
25+
* Where to redirect users after login.
26+
*
27+
* @var string
28+
*/
29+
protected $redirectTo = '/home';
30+
31+
/**
32+
* Create a new controller instance.
33+
*
34+
* @return void
35+
*/
36+
public function __construct()
37+
{
38+
$this->middleware('guest', ['except' => 'logout']);
39+
}
40+
41+
public function logout()
42+
{
43+
// return Auth::user();
44+
// dd("asdasdasd");
45+
return Auth::logout();
46+
}
47+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\User;
6+
use App\Http\Controllers\Controller;
7+
use Illuminate\Http\Request;
8+
use Illuminate\Support\Facades\Validator;
9+
use Illuminate\Foundation\Auth\RegistersUsers;
10+
11+
class RegisterController extends Controller
12+
{
13+
/*
14+
|--------------------------------------------------------------------------
15+
| Register Controller
16+
|--------------------------------------------------------------------------
17+
|
18+
| This controller handles the registration of new users as well as their
19+
| validation and creation. By default this controller uses a trait to
20+
| provide this functionality without requiring any additional code.
21+
|
22+
*/
23+
24+
use RegistersUsers;
25+
26+
/**
27+
* Where to redirect users after registration.
28+
*
29+
* @var string
30+
*/
31+
protected $redirectTo = '/home';
32+
33+
/**
34+
* Create a new controller instance.
35+
*
36+
* @return void
37+
*/
38+
public function __construct()
39+
{
40+
// $this->middleware('guest');
41+
}
42+
43+
/**
44+
* Get a validator for an incoming registration request.
45+
*
46+
* @param array $data
47+
* @return \Illuminate\Contracts\Validation\Validator
48+
*/
49+
protected function validator(array $data)
50+
{
51+
return Validator::make($data, [
52+
'name' => 'required|max:255',
53+
'email' => 'required|email|max:255|unique:users',
54+
'password' => 'required|min:6|confirmed',
55+
]);
56+
}
57+
58+
/**
59+
* Create a new user instance after a valid registration.
60+
*
61+
* @param Request $request
62+
* @return User
63+
* @internal param array $data
64+
*/
65+
// protected function create(array $data)
66+
// {
67+
// return User::create([
68+
// 'name' => $data['name'],
69+
// 'email' => $data['email'],
70+
// 'family' => $data['family'],
71+
// 'cellular' => $data['cellular'],
72+
// 'password' => bcrypt($data['password']),
73+
// ]);
74+
// }
75+
protected function store(Request $request)
76+
{
77+
// $attr = $request->only("name", "family", "cellular","email", "password");
78+
return User::create([
79+
'cellular' => $request->cellular,
80+
'name' => $request->name,
81+
'family' => $request->family,
82+
'email' => $request->email,
83+
'password' => bcrypt($request->password),
84+
]);
85+
}
86+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use Illuminate\Foundation\Auth\ResetsPasswords;
7+
8+
class ResetPasswordController extends Controller
9+
{
10+
/*
11+
|--------------------------------------------------------------------------
12+
| Password Reset Controller
13+
|--------------------------------------------------------------------------
14+
|
15+
| This controller is responsible for handling password reset requests
16+
| and uses a simple trait to include this behavior. You're free to
17+
| explore this trait and override any methods you wish to tweak.
18+
|
19+
*/
20+
21+
use ResetsPasswords;
22+
23+
/**
24+
* Where to redirect users after resetting their password.
25+
*
26+
* @var string
27+
*/
28+
protected $redirectTo = '/home';
29+
30+
/**
31+
* Create a new controller instance.
32+
*
33+
* @return void
34+
*/
35+
public function __construct()
36+
{
37+
$this->middleware('guest');
38+
}
39+
}

app/Http/Controllers/Controller.php

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Foundation\Bus\DispatchesJobs;
6+
use Illuminate\Routing\Controller as BaseController;
7+
use Illuminate\Foundation\Validation\ValidatesRequests;
8+
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
9+
10+
class Controller extends BaseController
11+
{
12+
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
13+
}

0 commit comments

Comments
 (0)