Skip to content

Commit 38af463

Browse files
committed
Allow users to update their username
1 parent cf5b686 commit 38af463

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

app/controllers/UsersController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function putSettings($userName)
5757
App::abort(403);
5858
}
5959

60-
return $this->updater->update($this, $user, Input::only('email'));
60+
return $this->updater->update($this, $user, Input::only('name', 'email'));
6161
}
6262

6363
public function getThreads($userName)
@@ -91,6 +91,6 @@ public function userUpdated($user, $emailChanged = false)
9191
Session::flash('success', 'Settings updated');
9292
}
9393

94-
return Redirect::route('user', $user->name);
94+
return Redirect::route('user.settings', $user->name);
9595
}
9696
}

app/views/auth/signupconfirm.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<p><img src="{{ $githubUser['image_url'] }}"/></p>
1313

1414
<p>
15-
{{ Form::label('name') }}
15+
{{ Form::label('name', 'Username') }}
1616
{{ Form::text('name', Input::old('name', $githubUser['name'])) }}
1717
</p>
1818

app/views/users/settings.blade.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
</div>
1313
<div class="user-settings">
1414
{{ Form::open(['route' => ['user.settings.update', $user->name], 'method' => 'put']) }}
15+
<p>
16+
{{ Form::label('name', 'Username') }}
17+
{{ Form::text('name', $user->name) }}
18+
</p>
19+
20+
@if ($errors->has('name'))
21+
<p>{{ $errors->first('name') }}</p>
22+
@endif
23+
1524
<p>
1625
{{ Form::label('email') }}
1726
{{ Form::email('email', $user->email) }}

public/scss/modules/_user.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
.auth {
1616
label {
1717
display: inline-block;
18-
width: 40px;
18+
width: 65px;
1919
}
2020
input {
2121
display: inline-block;
@@ -82,7 +82,7 @@
8282

8383
label {
8484
display: inline-block;
85-
width: 40px;
85+
width: 65px;
8686
}
8787
input {
8888
display: inline-block;

0 commit comments

Comments
 (0)