Login

LOGIN PAGE OVERVIEW

PURPOSE AND VALUE

The login page is the gateway that allows registered users to securely access their accounts, personal data, saved preferences, payment options, order history, etc.

It must balance security, usability, and brand cohesion. First impressions matter.

WHO USES IT

Registered customers of thcandvapes.co.uk—regular shoppers who have created an account.

Administrators or staff, if there’s a back‑end portal.

Visitors who may need prompting or links to register, reset password, or browse as guest.

 

2. UX DESIGN AND STRUCTURE

PAGE LAYOUT

Clean, focused layout with top‑of‑page branding (logo, site name).

A central box or panel containing the login form—ideally vertically and horizontally centered.

Minimal distractions; reserve side or bottom links for “Forgot password?”, “Register now”, and “Contact support”.

HEADINGS AND LABELS

Prominent heading: “LOG IN TO YOUR ACCOUNT”, styled consistently with your brand.

Use clear field labels: Email address or Username, and Password.

Provide placeholders only if they add clarity—not replacing labels.

FORM FIELDS & INPUT

Field 1: Email or username (depending on what you accept).

If only email, label it “Email address”.

Field 2: Password (type=password input).

Optionally: Remember me checkbox (with tooltip: “Keeps you signed in for 30 days” or similar).

Submit button: text like “Log In” or “Sign In”, styled large and disabled/enabled based on form validity.

LINKS TO OTHER ACTIONS

Forgot password? — leads to password recovery flow.

Create account — leads to registration page.

Optionally: Continue as guest or Browse without logging in (if your store supports guest checkout).

ERROR MESSAGES & FEEDBACK

Place error messages near the relevant field or at top for general errors.

Use color (e.g. red) and icons to highlight errors, ensuring high contrast for accessibility.

Example messages:

“Please enter your email.”

“Invalid email or password.”

“Your account is locked. Contact support.”

 

SUCCESS FEEDBACK

After successful login, show a quickLogging you in…” overlay before redirect.

Redirect to intended destination (e.g. account dashboard, previous page, or cart). If no default page, go to account overview.

 

3. BACK‑END FUNCTIONALITY

AUTHENTICATION WORKFLOW

1. Receive login form submission via HTTPS POST.

2. Normalize and validate input (trim whitespace, check email format).

3. Lookup user record by email or username.

4. Check password using secure comparison (e.g. bcrypt, Argon2, PBKDF2).

5. Optional: MFA or 2FA step if enabled for the account.

6. Initialize session / issue token:

Cookie‑based session: generate secure session identifier, store minimal state server‑side.

Token‑based (JWT): issue signed token with expiry, send as secure, httpOnly cookie or via header depending on architecture.

 

7. Set “remember me” cookie if option selected, with long expiry and a secure flag.

 

SESSION SECURITY

Set cookies with flags: Secure, HttpOnly, and SameSite (Strict or Lax).

Sessions should have timeout: inactivity expiration (e.g. 15‑30 min) and absolute expiry (e.g. 24 hours).

Provide logout function that fully invalidates session both client‑ and server‑side.

ACCOUNT LOCKOUT & RATE LIMITING

Implement per‑account failed login counter (e.g. lock after 5 attempts).

Implement IP‑based throttling, e.g. no more than X submissions per minute per IP.

After lockout, send email alert to the user (so they know someone tried and triggered lock).

Provide instructions or auto‑unlock after a cooling‑off period (e.g. account unlocks after 30 min) or manual unlock via password reset.

TWO‑FACTOR AUTHENTICATION (2FA)

If your business requires high security (e‑cigarettes, regulated products), allow optional MFA.

Common methods: Time‑based One‑Time Password (TOTP) apps (Google Authenticator), SMS codes, or email codes.

Upon login success with password, present second screen to input MFA code before final full login.

 

4. PASSWORD MANAGEMENT

STORE PASSWORDS SECURELY

Never store plain‑text passwords.

Use industry‑standard hashing functions: bcrypt, Argon2, PBKDF2, with appropriate cost settings.

Optionally include per‑user salt (often built into bcrypt or Argon2).

PASSWORD RESET FLOW

1. On “Forgot password?” user enters email.

2. Generate secure random token, store hashed token + expiry timestamp (e.g. valid for 1 hour).

3. Email user a reset link containing the token (link should be over HTTPS).

4. When user clicks link, render enter new password form—check token validity and expiration.

5. New password must meet strength requirements: minimum length (e.g. 8–12 chars), mixture of upper/lower case, digits, special characters.

6. On acceptance, hash and store new password, clear all existing sessions (force logout everywhere), and invalidate the token.

7. Email confirmation: “Your password was successfully changed.”

 

PASSWORD STRENGTH GUIDANCE

Display on form: password strength meter or inline guidance.

Optionally prevent weak passwords (e.g. check against dictionary list or common passwords).

 

5. SECURITY BEST PRACTICES

HTTPS / TLS

Enforce HTTPS site‑wide; redirect any HTTP traffic to HTTPS.

Use modern TLS cipher suites, configured securely to avoid protocol downgrade vulnerabilities.

Set HSTS header to force HTTPS use.

PROTECT AGAINST COMMON ATTACKS

CSRF: include CSRF tokens in login forms if needed, particularly if using cookies.

Brute force protection: combine rate limits, IP blocklists, CAPTCHA (after multiple failures), and account lockout.

Password spraying prevention: rate limit per IP and require CAPTCHA after suspicious volume.

Password enumeration prevention: use generic error messages (“Invalid credentials”) instead of “Email not found”.

XSS / Injection Prevent

Escape all output in forms and error messages.

Validate and sanitize input even if login fields often simple.

Use prepared queries when accessing database.

SESSION MANAGEMENT

Regenerate session identifier upon login (prevents session fixation).

Invalidate sessions on logout or password changes.

Use short token lifetimes, refresh token techniques if using JWTs.

LOGGING & MONITORING

Log each login attempt (success or failure), with timestamp, IP address, user agent.

Monitor logs for unusual spikes or geolocation anomalies.

Alert admins if multiple failed logins happen across many accounts.

 

6. ACCESSIBILITY & RESPONSIVENESS

ACCESSIBLE DESIGN (A11Y)

Provide aria-labels or aria-describedby on form fields.

Ensure keyboard navigation works: tab order, Enter key submits, focus ring visible.

Provide sufficient color contrast for labels, buttons, error messages.

Associate error messages with form inputs using aria-live region.

For CAPTCHAs or MFA steps, offer accessible alternatives if required.

MOBILE / RESPONSIVE UI

Form adapts to mobile screen widths:

Full‑width fields on narrow screens.

Buttons touch‑friendly (48px height minimum).

Avoid pop‑ups; use inline dialogues/responses for better mobile support.

 

7. DESIGN & BRANDING CONSIDERATIONS

VISUAL STYLE

Use your brand colors (e.g. THC and Vapes palette), fonts, and logo.

Maintain consistent button styling and typography across login and main site.

If desired, include a subtle background image or accent (e.g. smoke/floral motif), as long as it doesn’t impact readability or load time.

TRUST SIGNALS

Display security badges or SSL lock icon (e.g. “Secured by HTTPS”).

Include privacy statement or a link to “Privacy Policy” on the login page to reassure users about data protection.

OPTIONAL SOCIAL LOGIN

You may offer login via Google, Facebook, Apple, etc.—if appropriate and permitted in your region.

If you implement, adhere to OAuth best practices:

Request minimal scopes (“email” only).

Show clear “Log in with Google” buttons.

On sign‑up, map email and create an account if not existing.

Link social login to existing accounts where email matches, with a prompt.

 

8. NAVIGATION & USER FLOWS

ENTRY POINTS

Login button/link from top navigation or header—visible on every page for guests.

Checkout flow should redirect users to login if building cart requires account.

Optionally: “kiosk mode” or modal overlay login if user clicks cart icon on product pages.

REDIRECTION AFTER LOGIN

If user started login from a specific page (e.g. checkout or account page), redirect back to that page after login.

Otherwise, redirect to Account Dashboard, showing order status, recommendations, etc.

Avoid sending users to the homepage unnecessarily.

WHEN LOGIN FAILS

Keep form fields populated (except password) to ease correction.

On repeated failures, optionally show CAPTCHA or ask user to reset password.

MULTI‑PAGE FLOWS

Forgot password → email token → reset form → success page

New account → email verification → click link → account confirmed → redirect to login page

 

9. USER COMMUNICATION & EMAIL PRACTICES

EMAIL CONTENT

Password reset emails:

Clear subject: “Password reset request for your thcandvapes.co.uk account”

Body: personalized, instructions, link that expires, support contact info.

Account confirmation (if used):

Subject: “Confirm your email for thcandvapes.co.uk”

Include verification link and explanation why it’s needed.

Login alerts (optional):

Email to customer on suspicious activity (e.g. login from new device or location).

 

EMAIL DESIGN

Keep consistent branding (logo, colors).

Provide clear call‑to‑action button (“Reset password”).

Include support contact details and FOlymb? ensure link validation instructions.

 

10. PRIVACY & COMPLIANCE

DATA PROTECTION

Only collect necessary data (email, password).

Store data in encrypted databases or secure vaults.

Avoid logging passwords or personal data in plain text logs.

GDPR / UK‑DATA REQUIREMENTS (since Cambridgeshire / UK)

Under GDPR/UK‑GDPR, provide:

Privacy Notice link on login page.

Ability for user to request deletion or export of their data.

Age verification: Since vape and THC are age‑restricted, you may need to ensure member is 18+:

Optionally ask date of birth on sign‑up.

Validate via email or third‑party service.

User consent: On sign‑up, require acceptance of Terms & Conditions, Privacy Policy, age confirmation.

COOKIE NOTICE

If using cookies for “remember me” or session persistence, show a cookie banner on first visit with consent options.

 

11. TESTING AND QA

FUNCTIONAL TESTS

Test correct login flow:

Valid credentials → successful login → redirect.

Invalid credentials → error.

Locked account → error and email alert.

Password reset flow fully functional.

Test MFA (if used) in all edge cases—expired token, resend code, backup codes.

SECURITY AND PENETRATION TESTS

Run automated or manual penetration tests against:

SQL injection attempts via login inputs.

Cross‑site scripting (XSS).

CSRF (if endpoint allows).

Rate‑limiting bypass and brute‑force attempts.

 

USABILITY & ACCESSIBILITY TESTS

Keyboard‑only navigation.

Screen reader compatibility.

Mobile and desktop devices.

Color contrast audit (WCAG AA/AAA compliance).

PERFORMANCE

Load test the login page under concurrent requests.

Check that pages load fast (< 1.5 seconds).

Optimize assets (minified CSS/JS, compressed images, no bulky fonts).

 

12. MONITORING & MAINTENANCE

METRICS TO TRACK

Login success / failure ratio (percent successes vs failures).

Average time taken on login page (time from page load to submission).

Forgot password usage.

Account lockouts frequency.

MFA-enabled user percentage.

Failed attempts per IP / account to detect brute force.

ALERTING

Trigger alerts when:

Sudden spike in failed logins.

Multiple lockouts across many accounts.

Accounts are created from suspicious IPs or geographies.

 

REGULAR UPDATES

Keep authentication libraries up to date (e.g. bcrypt, OAuth, frameworks).

Renew TLS certificates prior to expiration.

Review configurations: session expiration, password policy, cookie flags.

USER TRAINING & SUPPORT

Provide internal documentation for support staff on:

Unlocking accounts.

Sending password reset emails manually (if system supports).

Addressing user login issues.

 

13. SAMPLE TECH STACK EXAMPLE

FRONT‑END

HTML5 + CSS3 with responsive layout (Flexbox/Grid).

JavaScript for form validation (email format, password length).

React or Vue: encapsulate login form in component; handle async requests and dynamic error display.

BACK‑END

Language/framework: Node.js + Express, Python/Django, PHP/Laravel, Ruby on Rails, etc.

Authentication library: e.g. Passport.js, Devise, django‑allauth.

Password hashing: bcrypt or Argon2 via library (e.g. bcrypt@latest).

Database: MySQL, PostgreSQL, or similar relational database storing users table.

API ENDPOINTS.

GET /api/auth/login-status — check if user is still authenticated (useful for single‑page apps).

SECURITY MIDDLEWARE

Rate‑limiter on login endpoints.

Helmet or equivalent for security headers.

CSRF protection if using cookie flow.

 

14. CASE STUDIES / EXAMPLES

EXAMPLE WIREFRAME STRUCTURE:

———————————————
| THC & VAPES |
| LOG IN TO YOUR ACCOUNT|
| Email: [__________] |
| Password: [*****] |
| [ ] Remember me |
| [ Log In ] |
| Forgot password? |
| Create account |
———————————————
| Privacy • Terms |
———————————————

WORST PRACTICE TO AVOID

Don’t let sessions persist forever with insecure cookies.

Don’t send password reset links without expiry.

Avoid overly complex captchas that block legitimate users, especially on mobile.

BEST PRACTICE EXAMPLE

Spotify’s login uses simple email/password fields, optional MFA, prominent brand visuals, generic error messaging—not revealing which part failed.

GitHub includes “Cancel”, “Verify your device”, time‑based MFA, remembers device, logs captures login history—clearly communicates steps.

 

15. COMPLETE CHECKLIST

Area Checklist Item

UX / UI Clean branding, labeled fields, minimal distractions
Input Validation Email format, password length, front/server side
Auth Flow Secure hashing, session handling, optional MFA
Security HTTPS enforced, CSRF, anti‑brute‑force, account lockout
Feedback Generic error messages, clear error display near fields
Reset Flow Secure token, strength rules, session invalidation
Accessibility A11Y compliance, screen‑reader, keyboard nav
Mobile Responsive layout, optimized inputs/buttons
Privacy GDPR compliance, cookie consent, data minimization
Monitoring Logs of login attempts, metric dashboards, alerts
Maintenance Regular library updates, certificate renewal, policy review

 

16. SUMMARY

Your login page must feel seamless and secure, fitting the visual identity of thcandvapes.co.uk.