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

Revert "Hide Google Log-in from Maker App" #38658

Merged
merged 1 commit into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/i18n/common/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,6 @@
"manageLinkedAccounts_microsoft": "Microsoft Account",
"manageLinkedAccounts_notConnected": "Not Connected",
"manageLinkedAccounts_rosteredSectionTooltip": "You cannot disconnect from this linked account because it is tied to one of your sections.",
"manageLinkedAccounts_makerAuthError": "This action cannot be done from the Maker App. Please return to your default browser and try again.",
"manageStudents": "Manage Students",
"manageStudentsNotificationFailure": "Something went wrong.",
"manageStudentsNotificationCannotAdd": "You could not add {numStudents, plural, one {1 student} other {# students}} to your section. Please try again or refresh the page.",
Expand Down
32 changes: 7 additions & 25 deletions apps/src/lib/ui/accounts/ManageLinkedAccounts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import BootstrapButton from './BootstrapButton';
import {connect} from 'react-redux';
import RailsAuthenticityToken from '../../util/RailsAuthenticityToken';
import {OAuthProviders} from '@cdo/apps/lib/ui/accounts/constants';
import {isCodeOrgBrowser} from '@cdo/apps/lib/kits/maker/util/browserChecks';

export const ENCRYPTED = `*** ${i18n.encrypted()} ***`;
const authOptionPropType = PropTypes.shape({
Expand Down Expand Up @@ -224,9 +223,6 @@ class OauthConnection extends React.Component {
? `/users/auth/${id}/disconnect`
: `/users/auth/${credentialType}?action=connect`;

const buttonDisabled =
!!disconnectDisabledStatus ||
(isCodeOrgBrowser() && credentialType === OAuthProviders.google);
return (
<tr>
<td style={styles.cell}>{displayName}</td>
Expand All @@ -241,34 +237,24 @@ class OauthConnection extends React.Component {
action={oauthToggleConnectionPath}
>
{/* This button intentionally uses BootstrapButton to match other
account page buttons.
This button is disabled according to disconnectDisabledStatus or
when the user is attempting this action from the Maker App for
their Google Account. This action is blocked due to Google authentication
security protocols.
*/}
account page buttons */}
<BootstrapButton
type="submit"
style={styles.button}
text={buttonText}
disabled={buttonDisabled}
disabled={!!disconnectDisabledStatus}
/>
<RailsAuthenticityToken />
</form>
{buttonDisabled && (
{disconnectDisabledStatus && (
<ReactTooltip
id={tooltipId}
offset={styles.tooltipOffset}
role="tooltip"
effect="solid"
>
<div style={styles.tooltip}>
{/* There are two causes for errors: disconnectDisabledStatus and logging in to
Google from the Maker App. Display the appropriate error text.
*/}
{disconnectDisabledStatus
? this.getDisconnectDisabledTooltip()
: i18n.manageLinkedAccounts_makerAuthError()}
{this.getDisconnectDisabledTooltip()}
</div>
</ReactTooltip>
)}
Expand All @@ -282,8 +268,6 @@ class OauthConnection extends React.Component {

const GUTTER = 20;
const BUTTON_WIDTH = 105;
const BUTTON_PADDING = 8;
const CELL_WIDTH = tableLayoutStyles.table.width / 3;
const styles = {
container: {
paddingTop: GUTTER
Expand All @@ -300,7 +284,7 @@ const styles = {
paddingLeft: GUTTER,
paddingRight: GUTTER,
fontWeight: 'normal',
width: CELL_WIDTH
width: tableLayoutStyles.table.width / 3
},
cell: {
...tableLayoutStyles.cell,
Expand All @@ -315,12 +299,10 @@ const styles = {
width: BUTTON_WIDTH,
fontFamily: '"Gotham 5r", sans-serif',
color: color.charcoal,
padding: BUTTON_PADDING
padding: 8
},
tooltipOffset: {
left:
CELL_WIDTH / 2 - // This moves the tooltip to be in between the 2nd and 3rd columns of the table
(tableLayoutStyles.cell.padding + BUTTON_PADDING + BUTTON_WIDTH / 2) // This centers the tooltip over the button in the 3rd column
left: -(BUTTON_WIDTH / 2)
},
tooltip: {
width: BUTTON_WIDTH * 2
Expand Down
5 changes: 0 additions & 5 deletions dashboard/app/views/devise/shared/_oauth_links.haml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,3 @@
:javascript

$('.oauth_sign_in').click(dashboard.clientState.reset);
// If the makerBridge is available, we are in the Maker App, which has its
// own Google login button. Hiding this google-oauth button to avoid confusion.
if (!!window.MakerBridge) {
$('.with-google_oauth2').hide();
}