Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overrode default authentication_error method and fixed the url prefix. #1040

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
93cc0a4
Bump redis from 3.5.3 to 4.3.6
dependabot[bot] Mar 27, 2023
33fbbde
First Solution
Workhqd May 10, 2023
b7f4100
Bump django from 4.2 to 4.2.3
dependabot[bot] Jul 11, 2023
329a943
Bump requests from 2.28.2 to 2.31.0
dependabot[bot] Jul 12, 2023
dfc83cd
Bump semver from 5.7.1 to 5.7.2
dependabot[bot] Jul 12, 2023
cc95234
remove react-helmet
QuanGiap Aug 10, 2023
22c6054
Update comment
QuanGiap Aug 16, 2023
ac233d6
Change code base on Peter suggestion
QuanGiap Aug 18, 2023
b9ed6eb
Override default authentication_error method and fixed the url prefix
ashwin-sp Sep 12, 2023
2ed0168
FA preconnect and Google font chain reduction
PeterBreen Oct 3, 2023
ca59222
Merge pull request #952 from DemocracyLab/dependabot/pip/redis-4.3.6
marlonkeating Oct 24, 2023
9ab1f92
Merge pull request #1003 from DemocracyLab/dependabot/pip/django-4.2.3
marlonkeating Oct 24, 2023
3a25e81
Merge pull request #1004 from DemocracyLab/dependabot/pip/requests-2.…
marlonkeating Oct 24, 2023
28f154b
Merge pull request #1005 from DemocracyLab/dependabot/npm_and_yarn/se…
marlonkeating Oct 24, 2023
174b63d
Resolve word-wrap to 1.2.4
marlonkeating Oct 24, 2023
d821e49
Merge branch 'master' into oauth_error_page_update
ashwin-sp Oct 27, 2023
02fa7e3
Merge pull request #1049 from DemocracyLab/peter/loadfonts2
marlonkeating Oct 29, 2023
0af5905
Merge pull request #971 from DemocracyLab/Try696-clicking-back-from-s…
marlonkeating Oct 29, 2023
2da397a
gtags added to companies page
ddfridley Oct 31, 2023
5c0d7d3
Resolve browserify-sign to 4.2.2
marlonkeating Nov 1, 2023
95c2cb0
Merge branch 'master' into 495-render-all-page-headers-on-backend-rem…
QuanGiap Nov 1, 2023
ecb25ed
remove react-helmet
QuanGiap Nov 1, 2023
53978c5
Merge pull request #1018 from DemocracyLab/495-render-all-page-header…
marlonkeating Nov 2, 2023
5fc771d
remove references to EMAIL_HOST_PASSWORD
Nov 6, 2023
e174261
Merge pull request #1058 from DemocracyLab/sprint-95-release
marlonkeating Nov 7, 2023
e32f769
can not dummy gtag
ddfridley Nov 7, 2023
49c68f9
safeGtag
ddfridley Nov 7, 2023
ea01214
Merge remote-tracking branch 'origin/master' into gtag#1034
ddfridley Nov 7, 2023
b86c146
CSP updates for hotjar
ddfridley Nov 7, 2023
b02d4de
Merge pull request #1067 from DemocracyLab/gtag#1034
marlonkeating Nov 12, 2023
f443329
Merge pull request #1068 from DemocracyLab/hotjar#1033
marlonkeating Nov 12, 2023
af39032
Merge pull request #1063 from DemocracyLab/remove_email_host
marlonkeating Nov 12, 2023
99b12aa
Merge pull request #1071 from DemocracyLab/sprint-96-release
marlonkeating Nov 20, 2023
bdde650
Override default authentication_error method and fixed the url prefix
ashwin-sp Sep 12, 2023
9f3eae4
Merge branch 'oauth_error_page_update' of https://github.com/Democrac…
ashwin-sp Dec 19, 2023
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: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default_language_version:
python: python3.8
python: python3.11
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ RUN npm rebuild node-sass
COPY . /code/

# Url prefix to generate links on the back-end
ENV PROTOCOL_DOMAIN "http://127.0.0.1:8000"
ENV PROTOCOL_DOMAIN "http://0.0.0.0:8000"

#Contact Us email address, used for Contact Form
ENV CONTACT_EMAIL "[email protected]"
Expand Down
3 changes: 0 additions & 3 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
"AWS_SECRET_ACCESS_KEY": {
"required": true
},
"EMAIL_HOST_PASSWORD": {
"required": true
},
"S3_BUCKET": {
"required": true
},
Expand Down
61 changes: 56 additions & 5 deletions civictechprojects/helpers/context_preload.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def about_project_preload(context, request):
print('Failed to preload project info, no cache entry found: ' + project_id)
return context


def about_event_preload(context, request):
context = default_preload(context, request)
query_args = url_params(request)
Expand Down Expand Up @@ -79,14 +78,14 @@ def about_group_preload(context, request):

def companies_preload(context, request):
context = default_preload(context, request)
context['title'] = 'DemocracyLab | Corporate Engagement'
context['title'] = 'Corporate Engagement | DemocracyLab'
context['description'] = 'Do well by doing good! Engage employees at custom events to build culture and spark innovation. Differentiate your brand by sponsoring our public hackathons.'
return context


def about_us_preload(context, request):
context = default_preload(context, request)
context['title'] = 'DemocracyLab | About'
context['title'] = 'About | DemocracyLab'
context['description'] = 'Learn About democracyLab, the nonprofit connecting skilled individuals to tech-for-good projects.'
return context

Expand All @@ -111,20 +110,47 @@ def create_event_preload(context, request):
context['description'] = 'Create event page'
return context

def create_group_preload(context, request):
context = default_preload(context, request)
context['title'] = 'Create a Group | DemocracyLab'
context['description'] = 'Create group page'
return context

def create_project_preload(context, request):
context = default_preload(context, request)
context['title'] = 'Create a Project | DemocracyLab'
context['description'] = 'Create project page'
return context

def my_projects_preload(context, request):
context = default_preload(context, request)
context['title'] = 'My Projects | DemocracyLab'
context['description'] = 'My Projects page'
return context


def my_groups_preload(context, request):
context = default_preload(context, request)
context['title'] = 'My Groups | DemocracyLab'
context['description'] = 'My Groups page'
return context

def find_events_preload(context, request):
context = default_preload(context, request)
context['title'] = 'Find Events | DemocracyLab'
context['description'] = 'Optimizing the connection between skilled volunteers and tech-for-good events'
return context

def find_groups_preload(context, request):
context = default_preload(context, request)
context['title'] = 'Find Groups | DemocracyLab'
context['description'] = 'Optimizing the connection between skilled volunteers and tech-for-good groups'
return context

def find_projects_preload(context, request):
context = default_preload(context, request)
context['title'] = 'Find Projects | DemocracyLab'
context['description'] = 'Optimizing the connection between skilled volunteers and tech-for-good projects'
return context

def my_events_preload(context, request):
context = default_preload(context, request)
Expand All @@ -144,6 +170,23 @@ def terms_preload(context, request):
context['description'] = 'Terms of Use page'
return context

def sign_up_preload(context, request):
context = default_preload(context, request)
context['title'] = 'Sign Up | DemocracyLab'
context['description'] = 'Sign up'
return context

def contact_us_preload(context, request):
context = default_preload(context, request)
context['title'] = 'Contact Us | DemocracyLab'
context['description'] = 'Contact information for DemocracyLab.'
return context

def reset_password_preload(context, request):
context = default_preload(context, request)
context['title'] = 'Reset Password | DemocracyLab'
context['description'] = 'Reset password page'
return context

def videos_preload(context, request):
context = default_preload(context, request)
Expand Down Expand Up @@ -182,6 +225,8 @@ def default_preload(context, request):
{'section': FrontEndSection.EditProfile.value, 'handler': edit_profile_preload},
{'section': FrontEndSection.AboutUs.value, 'handler': about_us_preload},
{'section': FrontEndSection.CreateEvent.value, 'handler': create_event_preload},
{'section': FrontEndSection.CreateGroup.value,'handler':create_group_preload},
{'section': FrontEndSection.CreateProject.value,'handler':create_project_preload},
{'section': FrontEndSection.MyProjects.value, 'handler': my_projects_preload},
{'section': FrontEndSection.MyGroups.value, 'handler': my_groups_preload},
{'section': FrontEndSection.MyEvents.value, 'handler': my_events_preload},
Expand All @@ -191,7 +236,13 @@ def default_preload(context, request):
{'section': FrontEndSection.VideoOverview.value, 'handler': videos_preload},
{'section': FrontEndSection.AboutEventProject.value, 'handler': about_event_project_preload},
{'section': FrontEndSection.Privacy.value, 'handler': privacy_preload},
{'section': FrontEndSection.Terms.value, 'handler': terms_preload}
{'section': FrontEndSection.Terms.value, 'handler': terms_preload},
{'section': FrontEndSection.SignUp.value, 'handler': sign_up_preload},
{'section': FrontEndSection.ContactUs.value,'handler':contact_us_preload},
{'section': FrontEndSection.ResetPassword.value,'handler':reset_password_preload},
{'section': FrontEndSection.FindEvents.value,'handler':find_events_preload},
{'section': FrontEndSection.FindGroups.value,'handler':find_groups_preload},
{'section': FrontEndSection.FindProjects.value,'handler':find_projects_preload},
]


Expand Down
5 changes: 1 addition & 4 deletions civictechprojects/static/css/styles.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
//import our variables first
@import "vars";
//import our fonts from Google Fonts
@import url("https://fonts.googleapis.com/css?family=Montserrat:400,500,600&display=swap");

//import third-party CSS, so we can use it and override it.

// IMPORTANT: Load our bootstrap overrides first, per Bootstrap's documentation.
// IMPORTANT: Load our bootstrap overrides first, per Bootstrap's documentation.
@import "bootstrapoverride";
//import required Bootstrap (foundation elements)
@import "vendor/bootstrap/functions";
Expand Down
4 changes: 4 additions & 0 deletions civictechprojects/templates/new_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
<script src="/static/js/runtime.bundle.js" defer></script>
<script src="/static/js/main.bundle.js" defer></script>
<script src="/static/js/vendors.bundle.js" defer></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600&display=swap" rel="stylesheet">
<link rel="preconnect" href="https://use.fontawesome.com" crossorigin>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v6.1.1/css/all.css" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="/static/css/main.styles.css"/>
<link rel="icon" type="image/png" href="{{FAVICON_PATH}}">
Expand Down
11 changes: 7 additions & 4 deletions common/components/chrome/MainHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,13 @@ class MainHeader extends React.Component<{||}, State> {
}

_handleHeightChange(height: number) {
UniversalDispatcher.dispatch({
type: "SET_HEADER_HEIGHT",
headerHeight: height,
});
// Use setTimeout with a delay of 0 ms to break the dispatch chain
setTimeout(() => {
UniversalDispatcher.dispatch({
type: "SET_HEADER_HEIGHT",
headerHeight: height,
});
}, 0);
this.props.onMainHeaderHeightChange(height);
}

Expand Down
31 changes: 0 additions & 31 deletions common/components/common/Headers.jsx

This file was deleted.

19 changes: 0 additions & 19 deletions common/components/common/projects/AboutProjectDisplay.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import VolunteerSection from "../volunteers/VolunteerSection.jsx";
import IconLinkDisplay from "../../componentsBySection/AboutProject/IconLinkDisplay.jsx";
import type { PositionInfo } from "../../forms/PositionInfo.jsx";
import CurrentUser, { MyGroupData } from "../../utils/CurrentUser.js";
import Headers from "../Headers.jsx";
import Truncate from "../../utils/truncate.js";
import Sort from "../../utils/sort.js";
import { LinkTypes } from "../../constants/LinkConstants.js";
Expand Down Expand Up @@ -113,7 +112,6 @@ class AboutProjectDisplay extends React.PureComponent<Props, State> {
return (
<div className={"container Profile-root" + widthModifier }>
{isWithinIframe() && <base target="_blank" />}
{this._renderHeader(project)}
<div className="row">
<div className="Profile-top-section col-12">
{this._renderTopSection(project)}
Expand Down Expand Up @@ -366,23 +364,6 @@ class AboutProjectDisplay extends React.PureComponent<Props, State> {
);
}

_renderHeader(project: ProjectDetailsAPIData): React$Node {
const title: string = project.project_name + " | DemocracyLab";
const description: string =
project.project_short_description ||
Truncate.stringT(project.project_description, 300);

return (
<Headers
title={title}
description={description}
thumbnailUrl={
project.project_thumbnail && project.project_thumbnail.publicUrl
}
/>
);
}

_renderContactAndVolunteerButtons(): React$Node {
return (
<div className="Profile-owner">
Expand Down
16 changes: 0 additions & 16 deletions common/components/controllers/AboutEventController.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
// @flow

import React from "react";
import Helmet from "react-helmet";
import ProjectAPIUtils from "../utils/ProjectAPIUtils.js";
import type { ProjectDetailsAPIData } from "../utils/ProjectAPIUtils.js";
import metrics from "../utils/metrics.js";
import Headers from "../common/Headers.jsx";
import Truncate from "../utils/truncate.js";
import AboutProjectDisplay from "../common/projects/AboutProjectDisplay.jsx";
import { APIError } from "../utils/api.js";
Expand Down Expand Up @@ -59,25 +57,11 @@ class AboutEventController extends React.PureComponent<{||}, State> {
_renderDetails(): React$Node {
return (
<React.Fragment>
{this._renderEventHeader(this.state.event)}
<AboutEventDisplay event={this.state.event} viewOnly={false} />
</React.Fragment>
);
}

_renderEventHeader(event: EventData): React$Node {
const title: string = event.event_name + " | DemocracyLab";
const description: string = event.event_short_description;

return (
<Headers
title={title}
description={description}
thumbnailUrl={event.event_thumbnail && event.event_thumbnail.publicUrl}
/>
);
}

_renderLoadMessage(): React$Node {
return (
<React.Fragment>
Expand Down
2 changes: 0 additions & 2 deletions common/components/controllers/AboutProjectController.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
// @flow

import React from "react";
import Helmet from "react-helmet";
import ProjectAPIUtils from "../utils/ProjectAPIUtils.js";
import type { ProjectDetailsAPIData } from "../utils/ProjectAPIUtils.js";
import metrics from "../utils/metrics.js";
import Headers from "../common/Headers.jsx";
import Truncate from "../utils/truncate.js";
import AboutProjectDisplay from "../common/projects/AboutProjectDisplay.jsx";
import { APIError } from "../utils/api.js";
Expand Down
9 changes: 0 additions & 9 deletions common/components/controllers/ContactUsController.jsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
// @flow

import React from "react";
import Headers from "../common/Headers.jsx";
import ContactForm from "../forms/ContactForm.jsx";

class ContactUsController extends React.PureComponent<{||}> {

_renderHeader(): React$Node {
const title: string = "DemocracyLab | Contact Us";
const description: string = "Contact information for DemocracyLab.";

return <Headers title={title} description={description} />;
}

render(): $React$Node {
return (
<React.Fragment>
{this._renderHeader()}
<div className="container contact-us-root">
<div className="row justify-content-center">
<div className="col-12 col-lg-10 col-xxl-9">
Expand Down
12 changes: 11 additions & 1 deletion common/components/controllers/CorporateHackathonController.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ const tabOptions: Dictionary<string> = {
sponsorship: "tab-sponsorship",
};

// for now we are trying to test this with a one file change. In the future we should handle this when and where the GOOGLE PROPERTY ID is set
// safeGtag needs to return true because event handlers need to return true for the event to keep propogating
//
const safeGtag=(...args)=>(window.gtag && gtag(...args),true)

class CorporateHackathonController extends React.PureComponent<{||}, State> {
constructor(props) {
super(props);
Expand Down Expand Up @@ -112,7 +117,8 @@ class CorporateHackathonController extends React.PureComponent<{||}, State> {
return (
<React.Fragment>
<div className="corporate-tab-section">
<Tabs defaultActiveKey={this.state.defaultTab} id="corporate-tabs">
<Tabs defaultActiveKey={this.state.defaultTab} id="corporate-tabs"
onSelect={tab_option=>safeGtag('event',tab_option)}>
<Tab
eventKey={tabOptions.hackathon}
title="Host a Tech-for-Good Hackathon"
Expand Down Expand Up @@ -194,6 +200,7 @@ class CorporateHackathonController extends React.PureComponent<{||}, State> {
variant="primary"
href="#contact-hackathon"
className="corporate-block-button"
onClick={e=>safeGtag('event','contact-hackathon')}
>
Get Started
</Button>
Expand Down Expand Up @@ -333,6 +340,7 @@ class CorporateHackathonController extends React.PureComponent<{||}, State> {
variant="primary"
href="#contact-sponsor"
className="corporate-block-button"
onClick={e=>safeGtag('event','contact-sponsor')}
>
Get Started
</Button>
Expand Down Expand Up @@ -443,6 +451,7 @@ class CorporateHackathonController extends React.PureComponent<{||}, State> {
href={cdn.document(
"2023+DemocracyLab+Corporate+Hackathon+Prospectus.pdf"
)}
onClick={e=>safeGtag('event','HackathonProspectus')}
>
Corporate Tech-for-Good Hackathons PDF{" "}
<i className={Glyph(GlyphStyles.PDF, GlyphSizes.X1)}></i>
Expand All @@ -455,6 +464,7 @@ class CorporateHackathonController extends React.PureComponent<{||}, State> {
href={cdn.document(
"2023+DemocracyLab+Sponsorship+Prospectus.pdf"
)}
onClick={e=>safeGtag('event','SponsorProspectus')}
>
Sponsor Prospectus PDF{" "}
<i className={Glyph(GlyphStyles.PDF, GlyphSizes.X1)}></i>
Expand Down
Loading