Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/pull_request_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
PHP_VERSION: 8.3
OTEL_SDK_DISABLED: true
OTEL_SERVICE_ENABLED: false
MAIL_FROM_EMAIL: noreply@tipit.net
MAIL_FROM_NAME: noreply@tipit.net
services:
mysql:
image: mysql:8.0
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
PHP_VERSION: 8.3
OTEL_SDK_DISABLED: true
OTEL_SERVICE_ENABLED: false
MAIL_FROM_EMAIL: noreply@tipit.net
MAIL_FROM_NAME: noreply@tipit.net
services:
mysql:
image: mysql:8.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,79 @@
@extends('emails.email_layout')

@section('content')
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:middle;" width="100%">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" width="100%">
<tbody>
<tr>
<td align="center" style="font-size:0px;padding:10px 25px;padding-right:25px;padding-left:25px;word-break:break-word;">
<div style="font-family:open Sans Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:center;color:#000000;">Your {!! Config::get('app.app_name') !!} <b><a href="#" style="text-decoration:none !important;color:black !important; cursor:default !important">{!!$user_email!!}</a></b> has been successfully verified.</div>
</td>
</tr>

@if(!empty($reset_password_link))
<tr>
<td align="center" style="font-size:0px;padding:10px 25px;word-break:break-word;">
<div style="font-family:open Sans Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:center;color:#000000;">Remember, if you need to set a password, you may do so <a href="{!! $reset_password_link !!}" target="_blank">here</a> (link expires in {!! $reset_password_link_lifetime !!} minutes).</div>
<td style="padding: 24px 40px 8px;">
<table border="0" cellpadding="0" cellspacing="0" role="presentation">
<tbody>
<tr>
<td style="vertical-align: middle; width: 38px; padding-right: 10px;">
<div style="width: 28px; height: 28px; border-radius: 50%; background: #1D9E75; text-align: center; line-height: 28px; font-size: 16px; color: #FFFFFF; font-weight: 700;">&#10003;</div>
</td>
<td style="vertical-align: middle;">
<h1 style="font-family: 'Open Sans', Helvetica, Arial, sans-serif; font-size: 22px; font-weight: 500; margin: 0; color: #0A0A0A; letter-spacing: -0.01em;">You're verified.</h1>
</td>
</tr>
</tbody>
</table>
<p style="font-family: 'Open Sans', Helvetica, Arial, sans-serif; font-size: 15px; color: #5F5E5A; margin: 12px 0 24px; line-height: 1.6;"><span style="font-family: 'Courier New', monospace; font-size: 14px; color: #0A0A0A;">{{ $user_email }}</span> is now your {!! Config::get('app.app_name') !!}.</p>
</td>
</tr>
@if(!empty($reset_password_link) || !$user_is_complete)
<tr>
<td style="padding: 0 40px 20px;">
<p style="font-family: 'Open Sans', Helvetica, Arial, sans-serif; font-size: 14px; color: #5F5E5A; margin: 0; line-height: 1.6;">
{{ !empty($reset_password_link) && !$user_is_complete ? 'Two quick things to finish setup:' : 'One quick thing to finish setup:' }}
</p>
</td>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
</tr>
@endif
@if(!empty($reset_password_link))
<tr>
<td style="padding: 0 40px 32px;">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" width="100%">
<tbody>
<tr>
<td style="vertical-align: top; width: 32px; padding-right: 10px;">
<div style="width: 22px; height: 22px; border-radius: 50%; background: #E6F1FB; color: #0C64C8; font-family: 'Open Sans', Helvetica, Arial, sans-serif; font-size: 12px; font-weight: 500; text-align: center; line-height: 22px;">1</div>
</td>
<td>
<div style="font-family: 'Open Sans', Helvetica, Arial, sans-serif; font-size: 15px; font-weight: 500; color: #0A0A0A; margin-bottom: 4px;">Set your password</div>
<p style="font-family: 'Open Sans', Helvetica, Arial, sans-serif; font-size: 14px; color: #5F5E5A; margin: 0 0 12px; line-height: 1.6;">Link expires in {!! $reset_password_link_lifetime !!} minutes.</p>
<a href="{!! $reset_password_link !!}" target="_blank" style="display: inline-block; background: #0A0A0A; color: #FFFFFF; text-decoration: none; font-family: 'Open Sans', Helvetica, Arial, sans-serif; font-size: 14px; font-weight: 500; padding: 9px 18px; border-radius: 6px;">Set password &rarr;</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
@endif
@if(!$user_is_complete)
<tr>
<td style="padding: 0 40px 32px;">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" width="100%">
<tbody>
<tr>
<td style="vertical-align: top; width: 32px; padding-right: 10px;">
<div style="width: 22px; height: 22px; border-radius: 50%; background: #E6F1FB; color: #0C64C8; font-family: 'Open Sans', Helvetica, Arial, sans-serif; font-size: 12px; font-weight: 500; text-align: center; line-height: 22px;">{{ !empty($reset_password_link) ? '2' : '1' }}</div>
</td>
<td>
<div style="font-family: 'Open Sans', Helvetica, Arial, sans-serif; font-size: 15px; font-weight: 500; color: #0A0A0A; margin-bottom: 4px;">Complete your profile</div>
<p style="font-family: 'Open Sans', Helvetica, Arial, sans-serif; font-size: 14px; color: #5F5E5A; margin: 0 0 12px; line-height: 1.6;">Add your name, company, and country. Photo and bio optional.</p>
<a href="{!! URL::action("UserController@getLogin") !!}" target="_blank" style="display: inline-block; background: transparent; color: #0A0A0A; text-decoration: none; font-family: 'Open Sans', Helvetica, Arial, sans-serif; font-size: 14px; font-weight: 500; padding: 8px 17px; border-radius: 6px; border: 1px solid #B4B2A9;">Open profile &rarr;</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
@endif
<tr>
<td style="background: #F5F4EF; padding: 20px 40px; font-family: 'Open Sans', Helvetica, Arial, sans-serif; font-size: 13px; color: #5F5E5A; text-align: center;">
Questions? <a href="mailto:{!! Config::get('app.help_email') !!}" style="color: #0C64C8; text-decoration: none;">{!! Config::get('app.help_email') !!}</a>
</td>
</tr>
@endif
@if(!$user_is_complete)
<tr>
<td align="center" style="font-size:0px;padding:10px 25px;padding-right:16px;padding-left:25px;word-break:break-word;">
<div style="font-family:open Sans Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:center;color:#000000;">You may enter your profile details <a href="{!! URL::action("UserController@getLogin") !!}" target="_blank">here</a>.</div>
</td>
</tr>
@endif
<tr>
<td align="center" style="font-size:0px;padding:10px 25px;padding-right:25px;padding-left:25px;word-break:break-word;">
<div style="font-family:open Sans Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:center;color:#000000;">If you need further assistance please email <a href="mailto:{!! Config::get('app.help_email') !!}">{!! Config::get('app.help_email') !!}</a>.</div>
</td>
</tr>
</tbody>
</table>
@stop
95 changes: 95 additions & 0 deletions tests/unit/EmailVerificationSuccessViewTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?php namespace Tests\unit;

/**
* Copyright 2026 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/

use App\Mail\UserEmailVerificationSuccess;
use Auth\User;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Queue;
use Tests\BrowserKitTestCase;

class EmailVerificationSuccessViewTest extends BrowserKitTestCase
{
protected function prepareForTests(): void
{
$_SERVER['HTTP_CLIENT_IP'] = '127.0.0.1';
Queue::fake();
Mail::fake();
}

private function makeUser(string $email, bool $complete): User
{
$user = $this->createMock(User::class);
$user->method('getEmail')->willReturn($email);
$user->method('getFullName')->willReturn('Preview User');
$user->method('getFirstName')->willReturn($complete ? 'Preview' : null);
$user->method('getLastName')->willReturn($complete ? 'User' : null);
$user->method('getCompany')->willReturn($complete ? 'ACME Inc.' : null);
$user->method('getCountry')->willReturn($complete ? 'US' : null);
return $user;
}

public function testVerificationSuccessWithPasswordLinkAndIncompleteProfile(): void
{
$email = 'preview+verified@example.com';
$resetLink = 'https://id.fntech.com/reset/abc123deadbeef';

$mailable = new UserEmailVerificationSuccess($this->makeUser($email, false), $resetLink);

$mailable->assertHasSubject(
sprintf('[%1$s] %1$s Verified', Config::get('app.app_name'))
);
$mailable->assertTo($email);

$html = $mailable->render();

$this->assertStringContainsString("You're verified.", $html);
$this->assertStringContainsString($email, $html);
$this->assertStringContainsString(Config::get('app.app_name'), $html);
// Both steps present
$this->assertStringContainsString('Two quick things to finish setup', $html);
$this->assertStringContainsString('Set your password', $html);
$this->assertStringContainsString($resetLink, $html);
$this->assertStringContainsString('Complete your profile', $html);
$this->assertStringContainsString('Open profile', $html);
// Footer
$this->assertStringContainsString(Config::get('app.help_email'), $html);

}

public function testVerificationSuccessWithoutPasswordLinkAndCompleteProfile(): void
{
$email = 'preview+verified-complete@example.com';

$mailable = new UserEmailVerificationSuccess($this->makeUser($email, true), null);

$mailable->assertHasSubject(
sprintf('[%1$s] %1$s Verified', Config::get('app.app_name'))
);
$mailable->assertTo($email);

$html = $mailable->render();

$this->assertStringContainsString("You're verified.", $html);
$this->assertStringContainsString($email, $html);
// No steps — intro paragraph should be absent
$this->assertStringNotContainsString('Two quick things to finish setup', $html);
$this->assertStringNotContainsString('Set your password', $html);
$this->assertStringNotContainsString('Complete your profile', $html);
// Footer always present
$this->assertStringContainsString(Config::get('app.help_email'), $html);

}
}
Loading