From de5885e3b0fe17e3920c7433c0f31bf2d3ea76ca Mon Sep 17 00:00:00 2001 From: Mir <65391345+Mir-SA@users.noreply.github.com> Date: Tue, 10 Dec 2024 22:56:30 +0530 Subject: [PATCH 1/5] added login route --- app/components/header.hbs | 32 +++++--- app/components/header.js | 7 +- app/components/login.hbs | 37 +++++++++ app/components/login.js | 33 ++++++++ app/constants/urls.js | 3 +- app/router.js | 1 + app/routes/application.js | 23 +++++- app/routes/login.js | 13 ++++ app/styles/app.css | 1 + app/styles/login.module.css | 85 +++++++++++++++++++++ app/templates/login.hbs | 2 + public/assets/icons/google-logo.png | Bin 0 -> 21164 bytes tests/constants/urls.js | 1 + tests/integration/components/login-test.js | 45 +++++++++++ tests/unit/routes/login-test.js | 32 ++++++++ 15 files changed, 300 insertions(+), 15 deletions(-) create mode 100644 app/components/login.hbs create mode 100644 app/components/login.js create mode 100644 app/routes/login.js create mode 100644 app/styles/login.module.css create mode 100644 app/templates/login.hbs create mode 100644 public/assets/icons/google-logo.png create mode 100644 tests/integration/components/login-test.js create mode 100644 tests/unit/routes/login-test.js diff --git a/app/components/header.hbs b/app/components/header.hbs index 54224285..eb8f56e7 100644 --- a/app/components/header.hbs +++ b/app/components/header.hbs @@ -51,7 +51,7 @@ class="nav__element" href={{this.STATUS_URL}} >Status - {{#if @dev}} + {{#if @dev}}
  • {{! TODO - remove query for dev when it goes to production }} {{else}} - {{/if}} {{/if}} diff --git a/app/components/header.js b/app/components/header.js index f268a922..39dc264d 100644 --- a/app/components/header.js +++ b/app/components/header.js @@ -6,6 +6,7 @@ import { inject as service } from '@ember/service'; export default class HeaderComponent extends Component { @service router; + @service featureFlag; @service fastboot; @tracked isNavOpen = false; @tracked isMenuOpen = false; @@ -36,6 +37,10 @@ export default class HeaderComponent extends Component { this.isMenuOpen = false; } + get isDevMode() { + return this.featureFlag.isDevMode; + } + generateAuthURL() { const currentURL = this.fastboot.isFastBoot ? this.fastboot.request.protocol + @@ -43,6 +48,6 @@ export default class HeaderComponent extends Component { this.fastboot.request.host + this.fastboot.request.path : window.location.href; - return `${AUTH.SIGN_IN}?redirectURL=${currentURL}`; + return `${AUTH.GITHUB_SIGN_IN}?redirectURL=${currentURL}`; } } diff --git a/app/components/login.hbs b/app/components/login.hbs new file mode 100644 index 00000000..7d69788f --- /dev/null +++ b/app/components/login.hbs @@ -0,0 +1,37 @@ + \ No newline at end of file diff --git a/app/components/login.js b/app/components/login.js new file mode 100644 index 00000000..8e1835dc --- /dev/null +++ b/app/components/login.js @@ -0,0 +1,33 @@ +import Component from '@glimmer/component'; +import { tracked } from '@glimmer/tracking'; +import { AUTH } from '../constants/urls'; +import { inject as service } from '@ember/service'; + +export default class LoginComponent extends Component { + @service router; + @service fastboot; + @service login; + @tracked authURL = this.generateAuthURL(); + + AUTH_URL = this.generateAuthURL(); + + generateAuthURL() { + let currentURL = this.fastboot.isFastBoot + ? this.fastboot.request.protocol + + '//' + + this.fastboot.request.host + + this.fastboot.request.path + : window.location.href; + + if (currentURL) { + currentURL = currentURL.includes('login') + ? currentURL.replace('login', '') + : currentURL; + } + + return { + GITHUB: `${AUTH.GITHUB_SIGN_IN}?redirectURL=${currentURL}`, + GOOGLE: `${AUTH.GOOGLE_SIGN_IN}&redirectURL=${currentURL}`, + }; + } +} diff --git a/app/constants/urls.js b/app/constants/urls.js index e4eaf6e0..019846c3 100644 --- a/app/constants/urls.js +++ b/app/constants/urls.js @@ -67,7 +67,8 @@ export const ABOUT = { }; export const AUTH = { - SIGN_IN: `${APPS.API_BACKEND}/auth/github/login`, + GITHUB_SIGN_IN: `${APPS.API_BACKEND}/auth/github/login`, + GOOGLE_SIGN_IN: `${APPS.API_BACKEND}/auth/google/login?dev=true`, SIGN_UP: `${APPS.PROFILE}/new-signup`, }; diff --git a/app/router.js b/app/router.js index a78344ed..47338ac7 100644 --- a/app/router.js +++ b/app/router.js @@ -16,4 +16,5 @@ Router.map(function () { this.route('events'); this.route('debug'); this.route('subscribe'); + this.route('login'); }); diff --git a/app/routes/application.js b/app/routes/application.js index 473ef158..20556493 100644 --- a/app/routes/application.js +++ b/app/routes/application.js @@ -1,2 +1,23 @@ import Route from '@ember/routing/route'; -export default class ApplicationRoute extends Route {} +import { inject as service } from '@ember/service'; +import { TOAST_OPTIONS } from '../constants/toast-options'; + +export default class ApplicationRoute extends Route { + @service router; + @service toast; + + showToast(transition) { + this.toast.error(transition.to.queryParams.error, 'Error', TOAST_OPTIONS); + } + + beforeModel(transition) { + if ( + transition?.to?.queryParams?.dev === 'true' && + transition?.to?.queryParams?.error + ) { + if (transition?.to?.queryParams?.error !== '') { + this.showToast(transition); + } + } + } +} diff --git a/app/routes/login.js b/app/routes/login.js new file mode 100644 index 00000000..43fbe9d5 --- /dev/null +++ b/app/routes/login.js @@ -0,0 +1,13 @@ +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; + +export default class LoginRoute extends Route { + @service router; + @service login; + + beforeModel(transition) { + if (transition?.to?.queryParams?.dev !== 'true') { + this.router.transitionTo('/page-not-found'); + } + } +} diff --git a/app/styles/app.css b/app/styles/app.css index 48c90b21..2ce11118 100644 --- a/app/styles/app.css +++ b/app/styles/app.css @@ -43,6 +43,7 @@ @import url("unauthenticated.module.css"); @import url("subscribe.module.css"); @import url("phone-input.module.css"); +@import url("login.module.css"); * { margin: 0; diff --git a/app/styles/login.module.css b/app/styles/login.module.css new file mode 100644 index 00000000..95dbd7ea --- /dev/null +++ b/app/styles/login.module.css @@ -0,0 +1,85 @@ +.login__container { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: white; + z-index: 9999; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} + +.login__container h3 { + text-align: center; + margin-top: 1rem; + font-size: 2.5rem; +} + +.link__container { + margin-top: 1.5rem; +} + +.link__container .join__link { + margin: 0; +} + +.link__container small { + font-size: medium; + margin: 0.75rem; +} + +.login__container h3 span { + font-size: 3rem; + color: var(--color-pink); +} + +.login__container a { + display: flex; + gap: 0.375rem; +} + +@media (width <= 625px) { + .logo__img { + width: 5rem; + } + + .login__container h3 { + font-size: 2rem; + } + + .login__container h3 span { + font-size: 2.5rem; + } + + .link__container small { + font-size: small; + margin: 0.5rem; + } + + .login__container a img { + height: 1.25rem; + width: 1.25rem; + } +} + +@media (width <= 425px) { + .login__container h3 { + font-size: 1.5rem; + } + + .login__container h3 span { + font-size: 2rem; + } + + .link__container { + margin-top: 1rem; + } + + .login__container a img { + height: 0.8rem; + width: 0.8rem; + } +} diff --git a/app/templates/login.hbs b/app/templates/login.hbs new file mode 100644 index 00000000..9208246d --- /dev/null +++ b/app/templates/login.hbs @@ -0,0 +1,2 @@ +{{page-title "Login"}} + \ No newline at end of file diff --git a/public/assets/icons/google-logo.png b/public/assets/icons/google-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..aa026d5fdb6de3e297d53409a50827cfffa567f9 GIT binary patch literal 21164 zcmce-1yo(jvZ#%_J0Z9QU$_N#f(4hL3wMVQ+}%C6Ymi{UA$V|?03o=$+goHOduN}0 z-aGe>|G$?pveufjyQ*t;SIw`h=1ho!oCGq$GXyX&Fk~r7QAN;qG3Z|*91Q5weA!(W z^abvqC?O2?Vfgtr=m5$@NLC08tSSoeP9GW!j3ol7FRcFbZSG`c0BR=!eH#K%#ep2$j!oKY{1IEWyHn1u_0p9nBx=^d0^&D5JiEgORRXx^JDBRTuyYvwXbQ?TvevgUa_}((&7Y~^lZ-lv z%qw%=6=vxMeXiCsX4xeOMm>1FS<_Vds6b|K29o(Ypsl{4;Gcp|v;9*LRoNm52xajV z3oA>x8GejB%+5IWvpIWLzPs?%r<1&szY9LC#!o>9s?WE#x~U>|he7iW$s0sbA-6WH zFy%C9=86qw!uwKx7kpZ|pMqTFE?KdpBbP*P@|{@u)vPv&z+lfNY~lF4p}(#u;7>tq7aI3H-N_<%2+~v0PviYM&A$kW z$%+0H^vSS41XD1v2*g3OX+h+!@oK^>T0t@EO!=}>?jJ$E{6i45cDX;7j{e75|J$WA zvo^6eGBh)?c4TyB0f~U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E+s?@TV4l23T8FCz#SX=0|y;^pv60R zpKeMIreUZ629ky|v~YBa=6neK^}V}`^8$uMZ4Js$9D+MEWq!f>z-&{%WE}XhrS+SmT1*J!yO&F&!?Y!E#xFPC;5MDFY`!;mYL|^HN6@l z46T7#(_`P&Jb>xN5}JA2$zj!lUZl_j1G+>*Ry%CZRvf!9=;BOR5gzFKa2gy21_lNO h1_lNOhS7i^{s*&Lbq|;NPQU;F002ovPDHLkV1kO)>Sh1{ literal 0 HcmV?d00001 diff --git a/tests/constants/urls.js b/tests/constants/urls.js index eaf0a096..8c10177f 100644 --- a/tests/constants/urls.js +++ b/tests/constants/urls.js @@ -8,6 +8,7 @@ export const APPS = { TASKS: 'https://my.realdevsquad.com/tasks', IDENTITY: 'https://my.realdevsquad.com/identity', MY_STATUS: 'https://my.realdevsquad.com', + API_BACKEND: 'https://staging-api.realdevsquad.com', }; export const ABOUT = { diff --git a/tests/integration/components/login-test.js b/tests/integration/components/login-test.js new file mode 100644 index 00000000..4db76a41 --- /dev/null +++ b/tests/integration/components/login-test.js @@ -0,0 +1,45 @@ +import { module, test } from 'qunit'; +import { render } from '@ember/test-helpers'; +import { hbs } from 'ember-cli-htmlbars'; +import { setupRenderingTest } from 'website-www/tests/helpers'; +import { APPS } from '../../constants/urls'; + +module('Integration | Component | login', function (hooks) { + setupRenderingTest(hooks); + + test('it renders content', async function (assert) { + await render(hbs``); + + assert.dom('.login__container').exists(); + assert.dom('.login__container h3').hasText('Sign In to Real Dev Squad'); + + assert + .dom('[data-test-github-auth]') + .exists('Github auth button is rendered'); + assert.dom('[data-test-github-auth]').hasText('Sign In with GitHub'); + + assert + .dom('[data-test-google-auth]') + .exists('Google auth button is rendered'); + assert.dom('[data-test-google-auth]').hasText('Sign In with Google'); + }); + + test('generates correct auth URLs', async function (assert) { + await render(hbs``); + + assert + .dom('[data-test-github-auth]') + .exists() + .hasAttribute( + 'href', + `${APPS.API_BACKEND}/auth/github/login?redirectURL=${window.location.href}`, + ); + assert + .dom('[data-test-google-auth]') + .exists() + .hasAttribute( + 'href', + `${APPS.API_BACKEND}/auth/google/login?dev=true&redirectURL=${window.location.href}`, + ); + }); +}); diff --git a/tests/unit/routes/login-test.js b/tests/unit/routes/login-test.js new file mode 100644 index 00000000..253d0cec --- /dev/null +++ b/tests/unit/routes/login-test.js @@ -0,0 +1,32 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'website-www/tests/helpers'; +import { visit, currentURL } from '@ember/test-helpers'; + +module('Unit | Route | login', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup('route:login'); + assert.ok(route); + }); + + test('it can be only visited with dev flag', async function (assert) { + await visit('/login?dev=true'); + + assert.strictEqual( + currentURL(), + '/login?dev=true', + 'User can access /login with dev flag only', + ); + }); + + test('it cannot be visited without dev flag', async function (assert) { + await visit('/login'); + + assert.strictEqual( + currentURL(), + '/page-not-found', + 'User cannot access /login without dev flag', + ); + }); +}); From ac2b348b24b6737b43b4881c2ef63998b8c0863b Mon Sep 17 00:00:00 2001 From: Mir <65391345+Mir-SA@users.noreply.github.com> Date: Tue, 17 Dec 2024 22:22:15 +0530 Subject: [PATCH 2/5] changed styles, templates & scripts --- app/components/header.hbs | 4 +- app/components/header.js | 5 -- app/components/login.hbs | 45 +++++++---------- app/components/login.js | 2 +- app/components/reusables/login-link.hbs | 14 ++++++ app/routes/application.js | 2 +- app/styles/login.module.css | 12 ++--- tests/integration/components/header-test.js | 8 ++- .../integration/components/login-link-test.js | 49 +++++++++++++++++++ tests/integration/components/login-test.js | 20 ++------ 10 files changed, 100 insertions(+), 61 deletions(-) create mode 100644 app/components/reusables/login-link.hbs create mode 100644 tests/integration/components/login-link-test.js diff --git a/app/components/header.hbs b/app/components/header.hbs index eb8f56e7..f263aacd 100644 --- a/app/components/header.hbs +++ b/app/components/header.hbs @@ -95,9 +95,9 @@ - + + + \ No newline at end of file diff --git a/app/components/login.js b/app/components/login.js index 8e1835dc..c34ffe9f 100644 --- a/app/components/login.js +++ b/app/components/login.js @@ -1,7 +1,7 @@ import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import { AUTH } from '../constants/urls'; -import { inject as service } from '@ember/service'; +import { service } from '@ember/service'; export default class LoginComponent extends Component { @service router; diff --git a/app/components/reusables/login-link.hbs b/app/components/reusables/login-link.hbs new file mode 100644 index 00000000..69e062a8 --- /dev/null +++ b/app/components/reusables/login-link.hbs @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/app/routes/application.js b/app/routes/application.js index 20556493..3d7c4032 100644 --- a/app/routes/application.js +++ b/app/routes/application.js @@ -1,5 +1,5 @@ import Route from '@ember/routing/route'; -import { inject as service } from '@ember/service'; +import { service } from '@ember/service'; import { TOAST_OPTIONS } from '../constants/toast-options'; export default class ApplicationRoute extends Route { diff --git a/app/styles/login.module.css b/app/styles/login.module.css index 95dbd7ea..620f3e85 100644 --- a/app/styles/login.module.css +++ b/app/styles/login.module.css @@ -28,7 +28,7 @@ .link__container small { font-size: medium; - margin: 0.75rem; + margin: 12px; } .login__container h3 span { @@ -38,7 +38,7 @@ .login__container a { display: flex; - gap: 0.375rem; + gap: 8px; } @media (width <= 625px) { @@ -60,8 +60,8 @@ } .login__container a img { - height: 1.25rem; - width: 1.25rem; + height: 20px; + width: 20px; } } @@ -79,7 +79,7 @@ } .login__container a img { - height: 0.8rem; - width: 0.8rem; + height: 12rem; + width: 12rem; } } diff --git a/tests/integration/components/header-test.js b/tests/integration/components/header-test.js index 93058f6d..426f7ed3 100644 --- a/tests/integration/components/header-test.js +++ b/tests/integration/components/header-test.js @@ -8,11 +8,12 @@ module('Integration | Component | header', function (hooks) { setupRenderingTest(hooks); test('header elements renders', async function (assert) { - assert.expect(13); + assert.expect(15); this.setProperties({ isLoggedIn: false, isLoading: false, + dev: false, }); this.set('signOut', () => { @@ -24,6 +25,7 @@ module('Integration | Component | header', function (hooks) { @isLoggedIn={{this.isLoggedIn}} @isLoading={{this.isLoading}} @signOut={{this.signOut}} + @dev={{this.dev}} /> `); @@ -52,6 +54,10 @@ module('Integration | Component | header', function (hooks) { */ // assert.dom('[data-test-login]').hasAttribute('href', AUTH.SIGN_IN); assert.dom('[data-test-login-img]').exists(); + + this.set('dev', true); + assert.dom('[data-test-login]').hasAttribute('href', '/login?dev=true'); + assert.dom('[data-test-login]').hasText('Sign In'); }); test('toggle nav menu in mobile view', async function (assert) { diff --git a/tests/integration/components/login-link-test.js b/tests/integration/components/login-link-test.js new file mode 100644 index 00000000..a81aeecc --- /dev/null +++ b/tests/integration/components/login-link-test.js @@ -0,0 +1,49 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'website-www/tests/helpers'; +import { render } from '@ember/test-helpers'; +import { hbs } from 'ember-cli-htmlbars'; + +module('Integration | Component | login-link', function (hooks) { + setupRenderingTest(hooks); + + test('it renders content', async function (assert) { + this.set('label', 'For Developers:'); + this.set('auth', 'github'); + this.set('signInText', 'Sign In with GitHub'); + this.set('iconSrc', 'assets/icons/github-logo.png'); + this.set('altText', 'GitHub'); + + await render(hbs` + `); + + assert.dom('small').exists('Label element exists'); + assert.dom('small').hasText('For Developers:', 'Label text is correct'); + + assert + .dom('.join__link span') + .hasText('Sign In with GitHub', 'Sign in text is correct'); + + assert.dom('.login__logo').exists('Logo image exists'); + assert + .dom('.login__logo') + .hasAttribute( + 'src', + 'assets/icons/github-logo.png', + 'Image has correct src', + ); + assert + .dom('.login__logo') + .hasAttribute('alt', 'GitHub', 'Image has correct alt text'); + assert + .dom('.login__logo') + .hasAttribute('height', '24px', 'Image has correct height'); + assert + .dom('.login__logo') + .hasAttribute('width', '24px', 'Image has correct width'); + }); +}); diff --git a/tests/integration/components/login-test.js b/tests/integration/components/login-test.js index 4db76a41..af7eb2bf 100644 --- a/tests/integration/components/login-test.js +++ b/tests/integration/components/login-test.js @@ -7,35 +7,21 @@ import { APPS } from '../../constants/urls'; module('Integration | Component | login', function (hooks) { setupRenderingTest(hooks); - test('it renders content', async function (assert) { + test('renders content & generates correct auth URLs', async function (assert) { await render(hbs``); assert.dom('.login__container').exists(); assert.dom('.login__container h3').hasText('Sign In to Real Dev Squad'); assert - .dom('[data-test-github-auth]') - .exists('Github auth button is rendered'); - assert.dom('[data-test-github-auth]').hasText('Sign In with GitHub'); - - assert - .dom('[data-test-google-auth]') - .exists('Google auth button is rendered'); - assert.dom('[data-test-google-auth]').hasText('Sign In with Google'); - }); - - test('generates correct auth URLs', async function (assert) { - await render(hbs``); - - assert - .dom('[data-test-github-auth]') + .dom('[data-test-login=github]') .exists() .hasAttribute( 'href', `${APPS.API_BACKEND}/auth/github/login?redirectURL=${window.location.href}`, ); assert - .dom('[data-test-google-auth]') + .dom('[data-test-login=google]') .exists() .hasAttribute( 'href', From 3936837f0582afcd890db9cceef98b6dab6eaf8b Mon Sep 17 00:00:00 2001 From: Mir <65391345+Mir-SA@users.noreply.github.com> Date: Fri, 20 Dec 2024 23:28:34 +0530 Subject: [PATCH 3/5] minor changes in scripts --- app/components/login.js | 3 --- tests/constants/urls.js | 2 +- tests/integration/components/login-test.js | 4 ++-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/components/login.js b/app/components/login.js index c34ffe9f..eca4ee6b 100644 --- a/app/components/login.js +++ b/app/components/login.js @@ -1,13 +1,10 @@ import Component from '@glimmer/component'; -import { tracked } from '@glimmer/tracking'; import { AUTH } from '../constants/urls'; import { service } from '@ember/service'; export default class LoginComponent extends Component { @service router; @service fastboot; - @service login; - @tracked authURL = this.generateAuthURL(); AUTH_URL = this.generateAuthURL(); diff --git a/tests/constants/urls.js b/tests/constants/urls.js index 8c10177f..399018bc 100644 --- a/tests/constants/urls.js +++ b/tests/constants/urls.js @@ -8,7 +8,7 @@ export const APPS = { TASKS: 'https://my.realdevsquad.com/tasks', IDENTITY: 'https://my.realdevsquad.com/identity', MY_STATUS: 'https://my.realdevsquad.com', - API_BACKEND: 'https://staging-api.realdevsquad.com', + STAGING_API_BACKEND: 'https://staging-api.realdevsquad.com', }; export const ABOUT = { diff --git a/tests/integration/components/login-test.js b/tests/integration/components/login-test.js index af7eb2bf..eb861ff9 100644 --- a/tests/integration/components/login-test.js +++ b/tests/integration/components/login-test.js @@ -18,14 +18,14 @@ module('Integration | Component | login', function (hooks) { .exists() .hasAttribute( 'href', - `${APPS.API_BACKEND}/auth/github/login?redirectURL=${window.location.href}`, + `${APPS.STAGING_API_BACKEND}/auth/github/login?redirectURL=${window.location.href}`, ); assert .dom('[data-test-login=google]') .exists() .hasAttribute( 'href', - `${APPS.API_BACKEND}/auth/google/login?dev=true&redirectURL=${window.location.href}`, + `${APPS.STAGING_API_BACKEND}/auth/google/login?dev=true&redirectURL=${window.location.href}`, ); }); }); From e860f4a9981efc5d8fa45b36022188880a3d47fa Mon Sep 17 00:00:00 2001 From: Mir <65391345+Mir-SA@users.noreply.github.com> Date: Thu, 26 Dec 2024 14:05:53 +0530 Subject: [PATCH 4/5] updated css --- app/styles/login.module.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/styles/login.module.css b/app/styles/login.module.css index 620f3e85..33f93c8b 100644 --- a/app/styles/login.module.css +++ b/app/styles/login.module.css @@ -5,7 +5,7 @@ width: 100%; height: 100%; background: white; - z-index: 9999; + z-index: 10; display: flex; flex-direction: column; align-items: center; From 78f6032f6c3c57b3322d9f1ef31692a7aca2984c Mon Sep 17 00:00:00 2001 From: Mir <65391345+Mir-SA@users.noreply.github.com> Date: Fri, 3 Jan 2025 20:52:12 +0530 Subject: [PATCH 5/5] css changes --- app/components/login.hbs | 8 ++++++- app/styles/login.module.css | 48 ++++++++++++++++++++++++++----------- app/styles/variables.css | 1 + 3 files changed, 42 insertions(+), 15 deletions(-) diff --git a/app/components/login.hbs b/app/components/login.hbs index 1ed11af4..f8848d8c 100644 --- a/app/components/login.hbs +++ b/app/components/login.hbs @@ -1,5 +1,11 @@