Skip to content

Commit

Permalink
Feature/2fa page improvements (#163)
Browse files Browse the repository at this point in the history
* updated text help

* added new phone number link
  • Loading branch information
matthew-inamdar authored Dec 7, 2018
1 parent 687d4ef commit 64ec601
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
23 changes: 22 additions & 1 deletion app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,28 @@ protected function authenticated(Request $request, User $user)
*/
public function showOtpForm()
{
return view('auth.code');
$userId = session()->get('otp.user_id');
$user = User::findOrFail($userId);
$phoneLastFour = substr($user->phone, -4);

$email = config('ck.global_admin.email');
$appName = config('app.name');
$subject = "{$user->full_name} - New Phone Number";
$subject = rawurlencode($subject);
$body = <<< EOT
{$user->full_name}:
Requires a new phone number for their account on $appName.
New number: xxxx-xxx-xxxx
EOT;
$body = rawurlencode($body);
$newNumberLink = "mailto:$email?subject=$subject&body=$body";

return view('auth.code', [
'phoneLastFour' => $phoneLastFour,
'newNumberLink' => $newNumberLink,
]);
}

/**
Expand Down
8 changes: 5 additions & 3 deletions resources/views/auth/code.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@
@section('content')
<div class="govuk-grid-row">
<div class="govuk-grid-column-one-half">
<h1 class="govuk-heading-xl">Login</h1>
<h1 class="govuk-heading-xl">Check your phone</h1>
<p class="govuk-body">We've sent you a text message with a security code to your registered number (ending {{ $phoneLastFour }}).</p>
<form method="POST" action="{{ route('login.code') }}" novalidate>

@csrf

<div class="govuk-form-group {{ $errors->has('token') ? 'govuk-form-group--error' : '' }}">
<label class="govuk-label govuk-label--m" for="token">
Authorisation code
Text message code
</label>
@if($errors->has('token'))
<span class="govuk-error-message">
{{ $errors->first('token') }}
</span>
@endif
<input class="govuk-input" id="token" name="token" type="password" aria-describedby="token-hint">
<input class="govuk-input govuk-input--width-4" id="token" name="token" type="password" aria-describedby="token-hint">
<p class="govuk-body"><a href="{{ $newNumberLink }}" class="govuk-link">New phone number?</a></p>
</div>

<button type="submit" class="govuk-button">
Expand Down

0 comments on commit 64ec601

Please sign in to comment.