Skip to content

Commit 398db1e

Browse files
authored
Merge pull request #602 from StephenMcConnel/BL-15618-RevertPreloginMessage
Revert "Notify user that scary permissions message for login is okay (BL-15618)"
2 parents 5d0b2b5 + 1dce5d1 commit 398db1e

4 files changed

Lines changed: 22 additions & 143 deletions

File tree

src/components/User/LoginDialog.tsx

Lines changed: 20 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -4,79 +4,34 @@ import { DialogTitle } from "@material-ui/core";
44
import Dialog from "@material-ui/core/Dialog";
55
import { FormattedMessage } from "react-intl";
66
import { StyledFirebaseAuthCodeSplit } from "../../authentication/firebase/StyledFirebaseAuthCodeSplit";
7-
import { PreLoginMessageDialog } from "./PreLoginMessageDialog";
87

98
let staticShowLoginDialog: (doOpen: boolean) => void = () => {};
109
export { staticShowLoginDialog as ShowLoginDialog };
1110

12-
const messageSeenCookieName = "BloomPreLoginMessageSeen";
13-
function setMessageSeenCookie(): void {
14-
// The expiration date is actually limited to about 400 days in the future by current browser implementations,
15-
// but setting it to 9999 makes it effectively permanent for our purposes.
16-
document.cookie = `${messageSeenCookieName}=true; Path=/; Expires=Fri, 31 Dec 9999 23:59:59 GMT;`;
17-
}
18-
function getMessageSeenCookie(): string | null {
19-
const nameEQ = `${messageSeenCookieName}=`;
20-
const cookies = document.cookie.split(";");
21-
for (let i = 0; i < cookies.length; i++) {
22-
const c = cookies[i].trim();
23-
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
24-
}
25-
return null;
26-
}
27-
2811
export const LoginDialog: React.FunctionComponent<{}> = (props) => {
2912
const [isOpen, setIsOpen] = useState(false);
30-
const [showMessageDialog, setShowMessageDialog] = useState(false);
31-
32-
const warningSeen = getMessageSeenCookie();
33-
34-
staticShowLoginDialog = (doOpen: boolean) => {
35-
if (warningSeen) {
36-
setShowMessageDialog(false);
37-
setIsOpen(doOpen);
38-
} else if (doOpen) {
39-
setShowMessageDialog(true);
40-
} else {
41-
setIsOpen(false);
42-
setShowMessageDialog(false);
43-
}
44-
setMessageSeenCookie();
45-
};
46-
47-
const handleContinue = () => {
48-
setShowMessageDialog(false);
49-
setIsOpen(true);
50-
};
5113

14+
staticShowLoginDialog = (doOpen: boolean) => setIsOpen(doOpen);
5215
return (
53-
<>
54-
<PreLoginMessageDialog
55-
open={showMessageDialog}
56-
onClose={handleContinue}
57-
onContinue={handleContinue}
58-
/>
59-
60-
<Dialog
61-
className="loginDialog"
62-
open={isOpen}
63-
onClose={() => setIsOpen(false)}
64-
aria-labelledby="title"
65-
>
66-
<DialogTitle id="title">
67-
<FormattedMessage
68-
id="usermenu.signIn"
69-
defaultMessage="Sign In / Sign Up"
16+
<Dialog
17+
className="loginDialog"
18+
open={isOpen}
19+
onClose={() => setIsOpen(false)}
20+
aria-labelledby="title"
21+
>
22+
<DialogTitle id="title">
23+
<FormattedMessage
24+
id="usermenu.signIn"
25+
defaultMessage="Sign In / Sign Up"
26+
/>
27+
</DialogTitle>
28+
{isOpen && (
29+
<div>
30+
<StyledFirebaseAuthCodeSplit
31+
loginComplete={() => staticShowLoginDialog(false)}
7032
/>
71-
</DialogTitle>
72-
{isOpen && (
73-
<div>
74-
<StyledFirebaseAuthCodeSplit
75-
loginComplete={() => staticShowLoginDialog(false)}
76-
/>
77-
</div>
78-
)}
79-
</Dialog>
80-
</>
33+
</div>
34+
)}
35+
</Dialog>
8136
);
8237
};

src/components/User/LoginForEditor.tsx

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,6 @@ export const LoginForEditor: React.FunctionComponent<{}> = observer(() => {
6565
</CloseableDialog>
6666
);
6767
} else {
68-
const l10n = useIntl();
69-
const successMsg = l10n.formatMessage({
70-
id: "login.succeeded",
71-
defaultMessage:
72-
"You successfully logged in! You can now return to Bloom and upload your book.",
73-
});
74-
const failureMsg = l10n.formatMessage({
75-
id: "login.failed",
76-
defaultMessage:
77-
"Login for Bloom Desktop App failed. Make sure that your browser's site settings for BloomLibrary.org allow 'Network Access' which is a scary way of saying that we can send a message to your Bloom Desktop app",
78-
});
7968
switch (result) {
8069
case IInformEditorResult.Success:
8170
case IInformEditorResult.Failure:
@@ -86,8 +75,8 @@ export const LoginForEditor: React.FunctionComponent<{}> = observer(() => {
8675
}}
8776
>
8877
{result === IInformEditorResult.Success
89-
? successMsg
90-
: failureMsg}
78+
? "You successfully logged in! You can now return to Bloom and upload your book."
79+
: "Log in failed. Please try again."}
9180
</CloseableDialog>
9281
);
9382
default:

src/components/User/PreLoginMessageDialog.tsx

Lines changed: 0 additions & 49 deletions
This file was deleted.

src/translations/BloomLibrary.org/Code Strings.json

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -471,22 +471,6 @@
471471
"description": "",
472472
"message": "Close"
473473
},
474-
"common.continue": {
475-
"description": "",
476-
"message": "Continue"
477-
},
478-
"login.beforeLoginMessage": {
479-
"description": "Priority - Low",
480-
"message": "Are you trying to log into your account from the Bloom desktop application? Your browser may ask you for some scary permissions, but really, we're simply trying to connect to your Bloom desktop app."
481-
},
482-
"login.succeeded": {
483-
"description": "Priority - Low",
484-
"message": "You successfully logged in! You can now return to Bloom and upload your book."
485-
},
486-
"login.failed": {
487-
"description": "Priority - Low",
488-
"message": "Login for Bloom Desktop App failed. Make sure that your browser's site settings for BloomLibrary.org allow 'Network Access' which is a scary way of saying that we can send a message to your Bloom Desktop app"
489-
},
490474
"book.concerns": {
491475
"description": "",
492476
"message": "What concerns do you have about this book?"

0 commit comments

Comments
 (0)