登录注册

This commit is contained in:
fthvgb1 2017-12-30 23:45:21 +08:00
parent 88ae714646
commit 151fa03b55
23 changed files with 58720 additions and 2042 deletions

View File

@ -25,7 +25,7 @@ class LoginController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = '/';
/**
* Create a new controller instance.

View File

@ -27,7 +27,7 @@ class RegisterController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = '/';
/**
* Create a new controller instance.

View File

@ -25,7 +25,7 @@ class ResetPasswordController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = '/';
/**
* Create a new controller instance.

View File

@ -0,0 +1,11 @@
<?php
namespace App\Http\Controllers;
class PagesController extends Controller
{
public function root()
{
return view('layouts.root');
}
}

View File

@ -18,7 +18,7 @@ class RedirectIfAuthenticated
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect('/home');
return redirect('/');
}
return $next($request);

13
app/helpers.php Normal file
View File

@ -0,0 +1,13 @@
<?php
/**
* Created by PhpStorm.
* User: xing
* Date: 2017/12/30
* Time: 22:23
*/
function route_class()
{
return str_replace('.', '-', \Illuminate\Support\Facades\Route::currentRouteName());
}

View File

@ -11,7 +11,8 @@
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0"
"laravel/tinker": "~1.0",
"overtrue/laravel-lang": "^3.0"
},
"require-dev": {
"filp/whoops": "~2.0",
@ -26,7 +27,10 @@
],
"psr-4": {
"App\\": "app/"
}
},
"files": [
"app/helpers.php"
]
},
"autoload-dev": {
"psr-4": {

125
composer.lock generated
View File

@ -4,8 +4,50 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "5eba86da256ddeb8084c32d3d10e18d3",
"content-hash": "248c18e4b26c8ecaedb1b6564a2ae6ac",
"packages": [
{
"name": "caouecs/laravel-lang",
"version": "3.0.39",
"source": {
"type": "git",
"url": "https://github.com/caouecs/Laravel-lang.git",
"reference": "5823b5299e372791a4b63c9276fb60fd5aa02869"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/caouecs/Laravel-lang/zipball/5823b5299e372791a4b63c9276fb60fd5aa02869",
"reference": "5823b5299e372791a4b63c9276fb60fd5aa02869",
"shasum": ""
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^1.10"
},
"suggest": {
"ablunier/laravel-lang-installer": "Command for easily add languages to a Laravel project",
"arcanedev/laravel-lang": "Translations manager and checker for Laravel 5",
"overtrue/laravel-lang": "Command to add languages in your project"
},
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "caouecs",
"email": "caouecs@caouecs.net"
}
],
"description": "Languages for Laravel",
"keywords": [
"lang",
"languages",
"laravel",
"lpm"
],
"time": "2017-11-06T19:03:05+00:00"
},
{
"name": "dnoegel/php-xdg-base-dir",
"version": "0.1",
@ -408,16 +450,16 @@
},
{
"name": "laravel/framework",
"version": "v5.5.27",
"version": "v5.5.28",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "b4fb6eeb227b7327b4ca7f92263b693ec9ac9875"
"reference": "cfafae1f2043208390a7c984e3070696f4969605"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/b4fb6eeb227b7327b4ca7f92263b693ec9ac9875",
"reference": "b4fb6eeb227b7327b4ca7f92263b693ec9ac9875",
"url": "https://api.github.com/repos/laravel/framework/zipball/cfafae1f2043208390a7c984e3070696f4969605",
"reference": "cfafae1f2043208390a7c984e3070696f4969605",
"shasum": ""
},
"require": {
@ -538,7 +580,7 @@
"framework",
"laravel"
],
"time": "2017-12-20T15:43:48+00:00"
"time": "2017-12-26T16:24:40+00:00"
},
{
"name": "laravel/tinker",
@ -863,16 +905,16 @@
},
{
"name": "nikic/php-parser",
"version": "v3.1.2",
"version": "v3.1.3",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "08131e7ff29de6bb9f12275c7d35df71f25f4d89"
"reference": "579f4ce846734a1cf55d6a531d00ca07a43e3cda"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/08131e7ff29de6bb9f12275c7d35df71f25f4d89",
"reference": "08131e7ff29de6bb9f12275c7d35df71f25f4d89",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/579f4ce846734a1cf55d6a531d00ca07a43e3cda",
"reference": "579f4ce846734a1cf55d6a531d00ca07a43e3cda",
"shasum": ""
},
"require": {
@ -910,7 +952,58 @@
"parser",
"php"
],
"time": "2017-11-04T11:48:34+00:00"
"time": "2017-12-26T14:43:21+00:00"
},
{
"name": "overtrue/laravel-lang",
"version": "3.0.8",
"source": {
"type": "git",
"url": "https://github.com/overtrue/laravel-lang.git",
"reference": "c49d5f86c2ab2302c06e10d7ebd66a1ac73e0bab"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/overtrue/laravel-lang/zipball/c49d5f86c2ab2302c06e10d7ebd66a1ac73e0bab",
"reference": "c49d5f86c2ab2302c06e10d7ebd66a1ac73e0bab",
"shasum": ""
},
"require": {
"caouecs/laravel-lang": "~3.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Overtrue\\LaravelLang\\TranslationServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Overtrue\\LaravelLang\\": "src/"
},
"files": [
"src/helpers.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "overtrue",
"email": "anzhengchao@gmail.com"
}
],
"description": "List of 52 languages for Laravel 5",
"keywords": [
"languages",
"laravel",
"overtrue"
],
"time": "2017-10-28T12:10:43+00:00"
},
{
"name": "paragonie/random_compat",
@ -1106,16 +1199,16 @@
},
{
"name": "psy/psysh",
"version": "v0.8.16",
"version": "v0.8.17",
"source": {
"type": "git",
"url": "https://github.com/bobthecow/psysh.git",
"reference": "d4c8eab0683dc056f2ca54ca67f5388527c068b1"
"reference": "5069b70e8c4ea492c2b5939b6eddc78bfe41cfec"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/bobthecow/psysh/zipball/d4c8eab0683dc056f2ca54ca67f5388527c068b1",
"reference": "d4c8eab0683dc056f2ca54ca67f5388527c068b1",
"url": "https://api.github.com/repos/bobthecow/psysh/zipball/5069b70e8c4ea492c2b5939b6eddc78bfe41cfec",
"reference": "5069b70e8c4ea492c2b5939b6eddc78bfe41cfec",
"shasum": ""
},
"require": {
@ -1174,7 +1267,7 @@
"interactive",
"shell"
],
"time": "2017-12-10T21:49:27+00:00"
"time": "2017-12-28T16:14:16+00:00"
},
{
"name": "ramsey/uuid",

View File

@ -65,7 +65,7 @@ return [
|
*/
'timezone' => 'UTC',
'timezone' => 'PRC',
/*
|--------------------------------------------------------------------------
@ -78,7 +78,7 @@ return [
|
*/
'locale' => 'en',
'locale' => 'zh-CN',
/*
|--------------------------------------------------------------------------

11507
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

5328
public/css/app.css vendored

File diff suppressed because it is too large Load Diff

43302
public/js/app.js vendored

File diff suppressed because one or more lines are too long

View File

@ -4,3 +4,54 @@
@import "variables";
// Bootstrap
@import "~bootstrap-sass/assets/stylesheets/bootstrap";
/* universal */
/* Sticky footer styles */
html {
position: relative;
min-height: 100%;
}
body {
/* Margin bottom by footer height */
margin-bottom: 60px;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 60px;
background-color: #000;
.container {
padding-right: 15px;
padding-left: 15px;
p {
margin: 19px 0;
color: #c1c1c1;
a {
color: inherit;
}
}
}
}
body {
font-family: Hiragino Sans GB, "Hiragino Sans GB", Helvetica, "Microsoft YaHei", Arial, sans-serif;
}
/* header */
.navbar-static-top {
border-color: #e7e7e7;
background-color: #fff;
box-shadow: 0px 1px 11px 2px rgba(42, 42, 42, 0.1);
border-top: 4px solid #00b5ad;
margin-bottom: 40px;
margin-top: 0px;
}

View File

@ -0,0 +1,71 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Login</div>
<div class="panel-body">
<form class="form-horizontal" method="POST" action="{{ route('login') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control" name="email"
value="{{ old('email') }}" required autofocus>
@if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label for="password" class="col-md-4 control-label">Password</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control" name="password" required>
@if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<div class="checkbox">
<label>
<input type="checkbox"
name="remember" {{ old('remember') ? 'checked' : '' }}> Remember Me
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-8 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Login
</button>
<a class="btn btn-link" href="{{ route('password.request') }}">
Forgot Your Password?
</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,48 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Reset Password</div>
<div class="panel-body">
@if (session('status'))
<div class="alert alert-success">
{{ session('status') }}
</div>
@endif
<form class="form-horizontal" method="POST" action="{{ route('password.email') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control" name="email"
value="{{ old('email') }}" required>
@if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Send Password Reset Link
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,72 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Reset Password</div>
<div class="panel-body">
<form class="form-horizontal" method="POST" action="{{ route('password.request') }}">
{{ csrf_field() }}
<input type="hidden" name="token" value="{{ $token }}">
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control" name="email"
value="{{ $email or old('email') }}" required autofocus>
@if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label for="password" class="col-md-4 control-label">Password</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control" name="password" required>
@if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
<label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control"
name="password_confirmation" required>
@if ($errors->has('password_confirmation'))
<span class="help-block">
<strong>{{ $errors->first('password_confirmation') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Reset Password
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,80 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Register</div>
<div class="panel-body">
<form class="form-horizontal" method="POST" action="{{ route('register') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name" class="col-md-4 control-label">Name</label>
<div class="col-md-6">
<input id="name" type="text" class="form-control" name="name"
value="{{ old('name') }}" required autofocus>
@if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control" name="email"
value="{{ old('email') }}" required>
@if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label for="password" class="col-md-4 control-label">Password</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control" name="password" required>
@if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group">
<label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control"
name="password_confirmation" required>
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Register
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,10 @@
<footer class="footer">
<div class="container">
<p class="pull-left">
<a href="http://weibo.com/u/1837553744?is_hot=1" target="_blank">Summer</a> 设计和编码 <span
style="color: #e27575;font-size: 14px;"></span>
</p>
<p class="pull-right"><a href="mailto:name@email.com">联系我们</a></p>
</div>
</footer>

View File

@ -0,0 +1,61 @@
<nav class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">
<!-- Collapsed Hamburger -->
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
data-target="#app-navbar-collapse">
<span class="sr-only">Toggle Navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- Branding Image -->
<a class="navbar-brand" href="{{ url('/') }}">
LaraBBS
</a>
</div>
<div class="collapse navbar-collapse" id="app-navbar-collapse">
<!-- Left Side Of Navbar -->
<ul class="nav navbar-nav">
</ul>
<!-- Right Side Of Navbar -->
<ul class="nav navbar-nav navbar-right">
<!-- Authentication Links -->
@guest
<li><a href="{{route('login')}}">登录</a></li>
<li><a href="{{route('register')}}">注册</a></li>
@else
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="user-avatar pull-left" style="margin-right:8px; margin-top:-5px;">
<img src="https://fsdhubcdn.phphub.org/uploads/images/201709/20/1/PtDKbASVcz.png?imageView2/1/w/60/h/60"
class="img-responsive img-circle" width="30px" height="30px">
</span>
{{ Auth::user()->name }} <span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="{{ route('logout') }}"
onclick="event.preventDefault();document.getElementById('logout-form').submit();">
退出登录
</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST"
style="display: none;">
{{ csrf_field() }}
</form>
</li>
</ul>
</li>
@endguest
</ul>
</div>
</div>
</nav>

View File

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>@yield('title', 'LaraBBS') - Laravel 进阶教程</title>
<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
</head>
<body>
<div id="app" class="{{ route_class() }}-page">
@include('layouts._header')
<div class="container">
@yield('content')
</div>
@include('layouts._footer')
</div>
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}"></script>
</body>
</html>

View File

@ -0,0 +1,6 @@
@extends('layouts.app')
@section('title', '首页')
@section('content')
<h1>这里是首页</h1>
@stop

View File

@ -69,7 +69,7 @@
@if (Route::has('login'))
<div class="top-right links">
@auth
<a href="{{ url('/home') }}">Home</a>
<a href="{{ url('/') }}">Home</a>
@else
<a href="{{ route('login') }}">Login</a>
<a href="{{ route('register') }}">Register</a>

View File

@ -11,6 +11,21 @@
|
*/
Route::get('/', function () {
return view('welcome');
});
use Illuminate\Support\Facades\Route;
Route::get('/', 'PagesController@root')->name('home');
// Authentication Routes...
Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
Route::post('login', 'Auth\LoginController@login');
Route::post('logout', 'Auth\LoginController@logout')->name('logout');
// Registration Routes...
Route::get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
Route::post('register', 'Auth\RegisterController@register');
// Password Reset Routes...
Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
Route::post('password/reset', 'Auth\ResetPasswordController@reset');