Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fixes #5185 - Access settings page directly from url
Browse files Browse the repository at this point in the history
  • Loading branch information
punamdahiya committed Nov 20, 2018
1 parent acecc07 commit 635ef90
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
3 changes: 1 addition & 2 deletions locales/en-US/server.ftl
Expand Up @@ -283,16 +283,15 @@ copyImageErrorMessage = Unable to copy your shot to the clipboard.
settingsDisconnectButton = Disconnect
.title = Disconnect
settingsGuestAccountMessage = Guest Account
settingsSignInInvite = Sign in to sync across devices
settingsSignInButton = Sign In
.title = Sign in
SettingsPageHeader = Firefox Screenshots Settings
settingsDescription = You can sign in with Firefox Accounts to sync all your screenshots across devices and access them privately.
settingsFirefoxAccountSubHeader = Firefox Account
settingsClosePreferences =
.title = Close preferences
settingsFxaDisconnectAlertMessage = Are you sure you want to disconnect this device from your Firefox Account?
settingsFxaDisconnectDescription = If you sign out, you will need to sign in again to regain access to your screenshots.
settingsFxaConnectDescription = You can sign in to access your screenshots across devices.
## Shotindex page

Expand Down
4 changes: 2 additions & 2 deletions server/src/pages/settings/server.js
Expand Up @@ -6,8 +6,8 @@ const app = express();
exports.app = app;

app.get("/", function(req, res) {
if (!(req.deviceId || req.accountId)) {
res.status(403).send("You must have Screenshots installed");
if (!req.accountId) {
res.redirect("/");
return;
}
if (req.originalUrl === "/settings/") {
Expand Down
7 changes: 2 additions & 5 deletions server/src/pages/settings/view.js
Expand Up @@ -75,18 +75,15 @@ class Body extends React.Component {
<Localized id="settingsGuestAccountMessage">
<p className="title">Guest Account</p>
</Localized>
<Localized id="settingsSignInInvite">
<p className="info">Sign in to sync across devices</p>
</Localized>
<Localized id="settingsSignInButton" attrs={{title: true}}>
<a className="account-buttons" href="/api/fxa-oauth/login/" onClick={ this.onClickConnect.bind(this)} title="Sign in">Sign In</a>
</Localized>
</div>
</div>
);
subInfo = (
<Localized id="settingsDescription">
<p className="sub-info">You can sign in with Firefox Accounts to sync all your screenshots across devices and access them privately.</p>
<Localized id="settingsFxaConnectDescription">
<p className="sub-info">You can sign in to access your screenshots across devices.</p>
</Localized>
);
}
Expand Down
2 changes: 1 addition & 1 deletion test/server/test_responses.py
Expand Up @@ -45,7 +45,7 @@ def test_settings_page_requires_auth():
user = ScreenshotsClient()

resp = requests.get(urljoin(user.backend, "/settings"))
assert resp.status_code == 403
assert resp.url == user.backend + "/"


def test_metrics_page():
Expand Down

0 comments on commit 635ef90

Please sign in to comment.