8000 Allow user to choose email and username on signup · laravelio/laravel.io@bd86000 · GitHub
[go: up one dir, main page]

Skip to content

Commit bd86000

Browse files
committed
Allow user to choose email and username on signup
1 parent 410bc00 commit bd86000

File tree

4 files changed

+34
-9
lines changed

4 files changed

+34
-9
lines changed

app/Lio/Accounts/User.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class User extends Entity implements UserInterface, RemindableInterface, Present
2424

2525
protected $validationRules = [
2626
'github_id' => 'unique:users,github_id,<id>',
27+
'email' => 'required|unique:users,email,<id>',
28+
'name' => 'required|unique:users,name,<id>',
2729
];
2830

2931
private $rolesCache;

app/controllers/AuthController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ public function postSignupConfirm()
8282

8383
$data = Session::get('userGithubData');
8484
$data['ip'] = Request::ip();
85+
$data['name'] = Input::get('name');
86+
$data['email'] = Input::get('email');
8587

8688
return App::make('Lio\Accounts\UserCreator')->create($this, $data);
8789
}
@@ -135,7 +137,7 @@ public function getResendConfirmation($code)
135137
// user creator responses
136138
public function userValidationError($errors)
137139
{
138-
return Redirect::to('/');
140+
return $this->redirectBack(['errors' => $errors]);
139141
}
140142

141143
public function userCreated($user)

app/views/auth/signupconfirm.blade.php

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,25 @@
88
{{ ReCaptcha::getScript() }}
99

1010
{{ Form::open() }}
11-
<img src="{{ $githubUser['image_url'] }}"/>
12-
1311
<div class="bio">
14-
@if (isset($githubUser['name']))
15-
<h2>{{ $githubUser['name'] }}</h2>
12+
<p><img src="{{ $githubUser['image_url'] }}"/></p>
13+
14+
<p>
15+
{{ Form::label('name') }}
16+
{{ Form::text('name', Input::old('email', $githubUser['name'])) }}
17+
</p>
18+
19+
@if ($errors->has('name'))
20+
<p>{{ $errors->first('name') }}</p>
1621
@endif
1722

18-
@if (isset($githubUser['email']))
19-
<p>{{ $githubUser['email'] }}</p>
23+
<p>
24+
{{ Form::label('email') }}
25+
{{ Form::email('email', Input::old('email', $githubUser['email'])) }}
26+
</p>
27+
28+
@if ($errors->has('email'))
29+
<p>{{ $errors->first('email') }}</p>
2030
@endif
2131

2232
<p>{{ ReCaptcha::getWidget() }}</p>
@@ -29,6 +39,5 @@
2939
</div>
3040
{{ Form::close() }}
3141
</div>
32-
3342
</section>
3443
@stop

public/scss/modules/_user.scss

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,26 @@
1212
margin: 15px 0 0 0;
1313
}
1414

15+
.auth {
16+
label {
17+
display: inline-block;
18+
width: 40px;
19+
}
20+
input {
21+
display: inline-block;
22+
padding: 5px 7px;
23+
width: 100%;
24+
max-width: 300px;
25+
}
26+
}
27+
1528
.user {
1629
@include clearfix;
1730
border-bottom:1px solid #cdcdcd;
1831
padding: 0 0 15px 0;
1932
margin: 0 0 15px 0;
2033

2134
img {
22-
float: left;
2335
height: auto;
2436
width:50px;
2537
display: block;

0 commit comments

Comments
 (0)
0