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

Commit

Permalink
fix disconnect button
Browse files Browse the repository at this point in the history
  • Loading branch information
Niharika Khanna committed Aug 25, 2017
1 parent eac2f9e commit 4332ac0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion server/src/pages/settings/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exports.disconnectDevice = function() {
// FIXME: a lame way to do an error message
window.alert("Error disconnecting: " + req.status + " " + req.statusText);
} else {
location.href = model.backend + "/settings";
location.reload();
}
};
req.send(`_csrf=${encodeURIComponent(model.csrfToken)}`);
Expand Down
2 changes: 1 addition & 1 deletion server/src/pages/settings/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Body extends React.Component {
<div className="info-container">
<p className="username title">{this.props.accountInfo.nickname || this.props.accountInfo.email}</p>
{ this.props.accountInfo.nickname ? <p className="email info">{this.props.accountInfo.email}</p> : null }
<a className="account-buttons disconnect" href="" onClick={ this.onClickDisconnect.bind(this) }>Disconnect</a>
<button className="account-buttons disconnect" onClick={ this.onClickDisconnect.bind(this) }>Disconnect</button>
</div>
</div>
);
Expand Down
3 changes: 2 additions & 1 deletion server/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,8 @@ app.post("/api/disconnect-device", csrfProtection, function(req, res) {
let cookies = new Cookies(req, res, {keys: keygrip});
if (result) {
cookies.set("accountid");
res.redirect('/settings');
cookies.set("accountid.sig");
simpleResponse(res, "ok", 200);
}
}).catch((err) => {
errorResponse(res, "Error: could not disconnect", err);
Expand Down

0 comments on commit 4332ac0

Please sign in to comment.