Skip to content

Commit

Permalink
Send email verification request if user has changed the email in prof…
Browse files Browse the repository at this point in the history
…ile edit page
  • Loading branch information
DariusIII committed Jun 21, 2018
1 parent f60db57 commit 08ef58c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
2018-06-21 DariusIII
* Chg: Send email verification request if user has changed the email in profile edit page
* Chg: Update some scripts, remove others
* Chg: Update laravel/framework to version 5.6.26, font-awesome and phpunit to latest
2018-06-20 DariusIII
Expand Down
10 changes: 9 additions & 1 deletion app/Http/Controllers/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use App\Models\UserExcludedCategory;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Mail;
use Jrean\UserVerification\Facades\UserVerification;

class ProfileController extends BasePageController
{
Expand Down Expand Up @@ -150,7 +151,6 @@ public function edit(Request $request)
break;
case 'submit':

$data['email'] = $request->input('email');
if ($request->has('saburl') && ! ends_with($request->input('saburl'), '/') && \strlen(trim($request->input('saburl'))) > 0) {
$request->merge(['saburl' => $request->input('saburl').'/']);
}
Expand Down Expand Up @@ -210,6 +210,14 @@ public function edit(Request $request)
User::updatePassword($userid, $request->input('password'));
}

if ($data['email'] !== $request->input('email')) {
$data['email'] = $request->input('email');

UserVerification::generate($data);

UserVerification::send($data, 'User email verification required');
}

return redirect('profile');
}
}
Expand Down

0 comments on commit 08ef58c

Please sign in to comment.