Skip to content

Commit 243be11

Browse files
Ivan LiIvan Li
Ivan Li
authored and
Ivan Li
committed
initial stage of register
1 parent 0aad158 commit 243be11

File tree

9 files changed

+86
-15
lines changed

9 files changed

+86
-15
lines changed

app/Http/Controllers/Auth/AuthController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ protected function create(array $data)
7676
'confirmation_code' => $confirmationCode,
7777
]);
7878

79-
Mail::send('email.verify', array("confirmation_code"=>$confirmationCode), function($message){
79+
Mail::send('emails.auth.verify', array("confirmation_code"=>$confirmationCode), function($message){
8080
$message->to(Input::get('email'), Input::get('name'))
8181
->subject('Welcome to ICL Knowledge Base');
8282
});

app/Http/Controllers/RoutingController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,9 @@ function login()
2020
{
2121
return view('login');
2222
}
23+
24+
function registerSuccess()
25+
{
26+
return view('login');
27+
}
2328
}

app/Http/routes.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,10 @@
1313
Route::group(['middleware' => ['web']], function () {
1414
Route::get('/', 'RoutingController@home');
1515
Route::get('login', 'RoutingController@login');
16+
Route::post('login', 'Auth\AuthController@postLogin');
17+
Route::post('register', 'Auth\AuthController@postRegister');
18+
Route::group(['prefix' => 'register'], function(){
19+
Route::get('/', 'RoutingController@registerSuccess');
20+
Route::get('verify/{confirmation_code}', 'Auth\AuthController@verify');
21+
});
1622
});

app/Permission.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: Ivan
5+
* Date: 1/06/2016
6+
* Time: 10:07 PM
7+
*/
8+
9+
namespace App;
10+
11+
12+
use Zizaco\Entrust\EntrustPermission;
13+
14+
class Permission extends EntrustPermission
15+
{
16+
17+
}

app/Role.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: Ivan
5+
* Date: 1/06/2016
6+
* Time: 10:06 PM
7+
*/
8+
9+
namespace App;
10+
11+
12+
use Zizaco\Entrust\Middleware\EntrustRole;
13+
14+
class Role extends EntrustRole
15+
{
16+
17+
}

app/User.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
namespace App;
44

55
use Illuminate\Foundation\Auth\User as Authenticatable;
6+
use Zizaco\Entrust\Traits\EntrustUserTrait;
67

78
class User extends Authenticatable
89
{
10+
use EntrustUserTrait;
911
/**
1012
* The attributes that are mass assignable.
1113
*
@@ -21,6 +23,6 @@ class User extends Authenticatable
2123
* @var array
2224
*/
2325
protected $hidden = [
24-
'password', 'remember_token',
26+
'password', 'remember_token', 'confirmation_code',
2527
];
2628
}

config/mail.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
|
5656
*/
5757

58-
'from' => ['address' => null, 'name' => null],
58+
'from' => ['address' => env('MAIL_FROM_ADDRESS'), 'name' => env('MAIL_FROM_NAME')],
5959

6060
/*
6161
|--------------------------------------------------------------------------
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: Ivan
5+
* Date: 1/06/2016
6+
* Time: 9:54 PM
7+
*/
8+
?>
9+
<!DOCTYPE html>
10+
<html lang="en-US">
11+
<head>
12+
<meta charset="utf-8">
13+
</head>
14+
<body>
15+
<h2>Welcome to ICL Knowledge Base</h2>
16+
17+
<div>
18+
Thanks for joining us. Please follow the link below to verify your email address
19+
<a href="{{ url('register/verify/' . $confirmation_code) }}" target="_blank">{{ url('register/verify/' . $confirmation_code) }}</a>.<br/>
20+
</div>
21+
</body>
22+
</html>
23+

resources/views/login.blade.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,25 @@
2525
<body id="skin-cloth">
2626
<section id="login">
2727
<header>
28-
<h1>ICL Knowledge Base</h1>
28+
<h1><a href="{{url('/')}}">ICL Knowledge Base</a></h1>
2929
<p class="login-paragraph">Welcome to ICL Knowledge Base. For better browsing experience, please login to discover more features of this site.</p>
3030
</header>
3131

3232
<div class="clearfix"></div>
3333

3434
<!-- Login -->
35-
<form class="box tile animated active" id="box-login">
35+
<form class="box tile animated active" id="box-login" action="{{url('login')}}" method="post">
36+
{!! csrf_field() !!}
3637
<h2 class="m-t-0 m-b-15">Login</h2>
37-
<input type="text" class="login-control m-b-10" placeholder="Email Address">
38-
<input type="password" class="login-control" placeholder="Password">
38+
<input type="text" name="email" class="login-control m-b-10" placeholder="Email Address">
39+
<input type="password" name="password" class="login-control" placeholder="Password">
3940
<div class="checkbox m-b-20">
4041
<label>
4142
<input type="checkbox">
4243
Remember Me
4344
</label>
4445
</div>
45-
<button class="btn btn-sm m-r-5">Sign In</button>
46+
<button class="btn btn-sm m-r-5" type="submit">Sign In</button>
4647

4748
<small>
4849
<a class="box-switcher" data-switch="box-register" href="#">Don't have an Account?</a> or
@@ -51,15 +52,15 @@
5152
</form>
5253

5354
<!-- Register -->
54-
<form class="box animated tile" id="box-register">
55+
<form class="box animated tile" id="box-register" action="{{url('register')}}" method="post">
56+
{!! csrf_field() !!}
5557
<h2 class="m-t-0 m-b-15">Register</h2>
56-
<input type="text" class="login-control m-b-10" placeholder="Full Name">
57-
<input type="text" class="login-control m-b-10" placeholder="Username">
58-
<input type="email" class="login-control m-b-10" placeholder="Email Address">
59-
<input type="password" class="login-control m-b-10" placeholder="Password">
60-
<input type="password" class="login-control m-b-20" placeholder="Confirm Password">
58+
<input type="text" name="name" class="login-control m-b-10" placeholder="Full Name">
59+
<input type="email" name="email" class="login-control m-b-10" placeholder="Email Address">
60+
<input type="password" name="password" class="login-control m-b-10" placeholder="Password">
61+
<input type="password" name="password_confirmation" class="login-control m-b-20" placeholder="Confirm Password">
6162

62-
<button class="btn btn-sm m-r-5">Register</button>
63+
<button class="btn btn-sm m-r-5" type="submit">Register</button>
6364

6465
<small><a class="box-switcher" data-switch="box-login" href="#">Already have an Account?</a></small>
6566
</form>

0 commit comments

Comments
 (0)