Skip to content

Commit 4b988f1

Browse files
committed
Add password resets & email configuration
1 parent e90240c commit 4b988f1

File tree

12 files changed

+173
-57
lines changed

12 files changed

+173
-57
lines changed

app/Http/Controllers/Auth/PasswordController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ class PasswordController extends Controller
2020

2121
use ResetsPasswords;
2222

23+
protected $redirectPath = '/';
24+
2325
/**
2426
* Create a new password controller instance.
2527
*

app/Http/routes.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@
1212
delete('logout', 'SessionsController@destroy')->name('logout');
1313

1414
get('signup/confirm/{token}', 'UsersController@confirmEmail')->name('confirm_email');
15+
16+
get('password/email', 'Auth\PasswordController@getEmail')->name('password.reset');
17+
post('password/email', 'Auth\PasswordController@postEmail')->name('password.reset');
18+
get('password/reset/{token}', 'Auth\PasswordController@getReset')->name('password.edit');
19+
post('password/reset', 'Auth\PasswordController@postReset')->name('password.update');

config/mail.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
|
2929
*/
3030

31-
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
31+
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
3232

3333
/*
3434
|--------------------------------------------------------------------------
@@ -54,7 +54,7 @@
5454
|
5555
*/
5656

57-
'from' => ['address' => null, 'name' => null],
57+
'from' => ['address' => '[email protected]', 'name' => 'Aufree'],
5858

5959
/*
6060
|--------------------------------------------------------------------------

public/css/app.css

Lines changed: 21 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/css/app.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/assets/sass/app.scss

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ textarea {
2020
text-align: center;
2121
}
2222

23+
.alert-status {
24+
@extend .alert-info;
25+
}
26+
2327
/* typography */
2428

2529
h1, h2, h3, h4, h5, h6 {
@@ -81,28 +85,38 @@ footer {
8185
padding-top: 5px;
8286
border-top: 1px solid #eaeaea;
8387
color: #777;
84-
}
8588

86-
footer a {
87-
color: #555;
88-
}
89+
a {
90+
color: #555;
91+
}
8992

90-
footer a:hover {
91-
color: #222;
92-
}
93+
a:hover {
94+
color: #222;
95+
}
9396

94-
footer small {
95-
float: left;
96-
}
97+
small {
98+
float: left;
99+
}
97100

98-
footer ul {
99-
float: right;
100-
list-style: none;
101-
}
101+
ul {
102+
float: right;
103+
list-style: none;
102104

103-
footer ul li {
104-
float: left;
105-
margin-left: 15px;
105+
li {
106+
float: left;
107+
margin-left: 15px;
108+
}
109+
}
110+
111+
img.brand-icon {
112+
width: 17px;
113+
height: 17px;
114+
}
115+
116+
.slogon {
117+
font-size: 13px;
118+
font-weight: bold;
119+
}
106120
}
107121

108122
/* sidebar */
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@extends('layouts.default')
2+
@section('title', '重置密码')
3+
4+
@section('content')
5+
<div class="container-fluid">
6+
<div class="row">
7+
<div class="col-md-8 col-md-offset-2">
8+
<div class="panel panel-default">
9+
<div class="panel-heading">重置密码</div>
10+
<div class="panel-body">
11+
@include('shared.errors')
12+
<form method="POST" action="{{ route('password.reset') }}">
13+
{{ csrf_field() }}
14+
15+
<div class="form-group">
16+
<label class="col-md-4 control-label">邮箱地址:</label>
17+
<div class="col-md-6">
18+
<input type="email" class="form-control" name="email" value="{{ old('email') }}">
19+
</div>
20+
</div>
21+
22+
<div class="form-group">
23+
<div class="col-md-6 col-md-offset-4">
24+
<button type="submit" class="btn btn-primary">
25+
重置
26+
</button>
27+
</div>
28+
</div>
29+
</form>
30+
</div>
31+
</div>
32+
</div>
33+
</div>
34+
</div>
35+
@stop

resources/views/auth/reset.blade.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
@extends('layouts.default')
2+
@section('title', '更新密码')
3+
4+
@section('content')
5+
<div class="container-fluid">
6+
<div class="row">
7+
<div class="col-md-8 col-md-offset-2">
8+
<div class="panel panel-default">
9+
<div class="panel-heading">更新密码</div>
10+
<div class="panel-body">
11+
@include('shared.errors')
12+
13+
<form method="POST" action="{{ route('password.update') }}">
14+
<input type="hidden" name="_token" value="{{ csrf_token() }}">
15+
<input type="hidden" name="token" value="{{ $token }}">
16+
17+
<div class="form-group">
18+
<label class="col-md-4 control-label">邮箱地址:</label>
19+
<div class="col-md-6">
20+
<input type="email" class="form-control" name="email" value="{{ old('email') }}">
21+
</div>
22+
</div>
23+
24+
<div class="form-group">
25+
<label class="col-md-4 control-label">密码:</label>
26+
<div class="col-md-6">
27+
<input type="password" class="form-control" name="password">
28+
</div>
29+
</div>
30+
31+
<div class="form-group">
32+
<label class="col-md-4 control-label">确认密码:</label>
33+
<div class="col-md-6">
34+
<input type="password" class="form-control" name="password_confirmation">
35+
</div>
36+
</div>
37+
38+
<div class="form-group">
39+
<div class="col-md-6 col-md-offset-4">
40+
<button type="submit" class="btn btn-primary">
41+
更新密码
42+
</button>
43+
</div>
44+
</div>
45+
</form>
46+
</div>
47+
</div>
48+
</div>
49+
</div>
50+
</div>
51+
@stop
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<p>点击下面链接重置密码:</p>
2+
3+
<a href="{{ route('password.update') . '/' . $token }}">
4+
{{ route('password.update') . '/' . $token }}
5+
</a>

resources/views/layouts/_footer.blade.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<div class="col-md-12">
22
<footer class="footer">
3-
<small>
4-
Made with love by <a href="https://github.com/summerblue">Summer</a>
3+
<small class="slogon">
4+
<img class="brand-icon" src="https://dn-phphub.qbox.me/uploads/images/201612/12/1/iq7WQc2iuW.png?imageView2/1/w/34/h/34">
5+
<a href="http://estgroupe.com/">
6+
优帆远扬 | 创造不息,交付不止
7+
</a>
58
</small>
69
<nav>
710
<ul>

resources/views/sessions/create.blade.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,28 @@
1111
@include('shared.errors')
1212

1313
<form method="POST" action="{{ route('login') }}">
14-
{{ csrf_field() }}
14+
{{ csrf_field() }}
1515

16-
<div class="form-group">
17-
<label for="email">邮箱:</label>
18-
<input type="text" name="email" class="form-control" value="{{ old('email') }}">
19-
</div>
16+
<div class="form-group">
17+
<label for="email">邮箱:</label>
18+
<input type="text" name="email" class="form-control" value="{{ old('email') }}">
19+
</div>
2020

21-
<div class="form-group">
22-
<label for="password">密码:</label>
23-
<input type="password" name="password" class="form-control" value="{{ old('password') }}">
24-
</div>
21+
<div class="form-group">
22+
<label for="password">密码(<a href="{{ route('password.reset') }}">忘记密码</a>):</label>
23+
<input type="password" name="password" class="form-control" value="{{ old('password') }}">
24+
</div>
2525

26-
<div class="checkbox">
27-
<label><input type="checkbox" name="remember"> 记住我</label>
28-
</div>
26+
<div class="checkbox">
27+
<label><input type="checkbox" name="remember"> 记住我</label>
28+
</div>
2929

30-
<button type="submit" class="btn btn-primary">登录</button>
30+
<button type="submit" class="btn btn-primary">登录</button>
3131
</form>
3232

3333
<hr>
3434

35-
<p>还没账号?<a href="{{ ('signup') }}">现在注册!</a></p>
35+
<p>还没账号?<a href="{{ route('signup') }}">现在注册!</a></p>
3636
</div>
3737
</div>
3838
</div>

resources/views/shared/messages.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@foreach (['danger', 'warning', 'success', 'info'] as $msg)
1+
@foreach (['danger', 'warning', 'success', 'info', 'status'] as $msg)
22
@if(session()->has($msg))
33
<div class="flash-message">
44
<p class="alert alert-{{ $msg }}">

0 commit comments

Comments
 (0)