-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(account): show dialog after password change success
- Loading branch information
1 parent
e74e7b1
commit ec779c5
Showing
4 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { FlatButton, Dialog } from 'material-ui'; | ||
|
||
import appActions from '../app.actions'; | ||
|
||
// In development environments this won't provide the correct behavior | ||
// because the app is hosted on a different port, but once an app is deployed | ||
// reloading the window with an invalidated session will redirect to the login page | ||
const reload = () => { | ||
appActions.setCategory('account') | ||
window.location.reload(true); | ||
} | ||
|
||
function PasswordChangeSuccessDialog(props, context) { | ||
const titleText = context.d2.i18n.getTranslation('password_changed_successfully'); | ||
const bodyText = context.d2.i18n.getTranslation('login_again'); | ||
const buttonText = context.d2.i18n.getTranslation('login'); | ||
|
||
const buttons = [ | ||
<FlatButton label={buttonText} primary onClick={reload} />, | ||
]; | ||
return ( | ||
<Dialog | ||
title={titleText} | ||
actions={buttons} | ||
modal | ||
open | ||
> | ||
{bodyText} | ||
</Dialog> | ||
); | ||
} | ||
|
||
PasswordChangeSuccessDialog.contextTypes = { | ||
d2: PropTypes.object.isRequired | ||
}; | ||
|
||
export default PasswordChangeSuccessDialog; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters