Show portal link for existing accounts even if never logged in

Previously required both has_account && returning (logged in before).
Now shows portal link whenever has_account is true.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
justin 2026-04-28 04:35:22 -05:00
parent e76f54b11f
commit af65fca709

View file

@ -87,8 +87,8 @@ Send reset link
fetch(API + "/api/v1/auth/portal-status?email=" + encodeURIComponent(email))
.then(function(r) { return r.json(); })
.then(function(data) {
if (data.has_account && data.returning) {
// Returning customer — hide password form, show welcome back
if (data.has_account) {
// Existing account — hide password form, show portal link
var form = document.getElementById("portal-password-form");
var already = document.getElementById("portal-already-set");
if (form) form.classList.add("hidden");
@ -97,8 +97,10 @@ Send reset link
already.innerHTML =
'<div class="rounded-lg bg-blue-50 border border-blue-200 p-3 flex items-center gap-2 text-sm text-blue-800">' +
'<svg class="w-4 h-4 text-blue-600 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>' +
'Welcome back' + (data.name ? ', ' + data.name.split(' ')[0] : '') + '! This order has been added to your portal. ' +
'<a href="https://portal.performancewest.net" class="underline font-medium hover:text-blue-900 ml-1">Log in to your portal &rarr;</a>' +
(data.returning
? 'Welcome back' + (data.name ? ', ' + data.name.split(' ')[0] : '') + '! This order has been added to your portal. '
: 'Your portal account is ready. ') +
'<a href="https://portal.performancewest.net" class="underline font-medium hover:text-blue-900 ml-1">Go to your portal &rarr;</a>' +
'</div>';
}
}