Переименовал passwordChange -> changePassword

This commit is contained in:
SleepWalker 2016-03-16 07:34:18 +02:00
parent d19735b7e1
commit 7ce8637e38
7 changed files with 29 additions and 19 deletions

View File

@ -194,7 +194,7 @@ class PanelTransition extends Component {
'/password': 1, '/password': 1,
'/activation': 1, '/activation': 1,
'/oauth/permissions': -1, '/oauth/permissions': -1,
'/password-change': 1, '/change-password': 1,
'/forgot-password': 1 '/forgot-password': 1
}; };
const sign = map[key]; const sign = map[key];
@ -216,7 +216,7 @@ class PanelTransition extends Component {
'/register': not('/activation') ? 'Y' : 'X', '/register': not('/activation') ? 'Y' : 'X',
'/activation': not('/register') ? 'Y' : 'X', '/activation': not('/register') ? 'Y' : 'X',
'/oauth/permissions': 'Y', '/oauth/permissions': 'Y',
'/password-change': 'Y', '/change-password': 'Y',
'/forgot-password': not('/password') && not('/login') ? 'Y' : 'X' '/forgot-password': not('/password') && not('/login') ? 'Y' : 'X'
}; };

View File

@ -5,15 +5,14 @@ import Helmet from 'react-helmet';
import buttons from 'components/ui/buttons.scss'; import buttons from 'components/ui/buttons.scss';
import { Input } from 'components/ui/Form'; import { Input } from 'components/ui/Form';
import BaseAuthBody from 'components/auth/BaseAuthBody'; import BaseAuthBody from 'components/auth/BaseAuthBody';
import passwordChangedMessages from './PasswordChange.messages';
import icons from 'components/ui/icons.scss'; import icons from 'components/ui/icons.scss';
import styles from './passwordChange.scss';
import messages from './ChangePassword.messages';
import styles from './changePassword.scss';
class Body extends BaseAuthBody { class Body extends BaseAuthBody {
static displayName = 'PasswordChangeBody'; static displayName = 'ChangePasswordBody';
render() { render() {
return ( return (
@ -25,40 +24,47 @@ class Body extends BaseAuthBody {
</div> </div>
<p className={styles.descriptionText}> <p className={styles.descriptionText}>
<Message {...passwordChangedMessages.changePasswordMessage} /> <Message {...messages.changePasswordMessage} />
</p> </p>
<Input {...this.bindField('newPassword')} <Input {...this.bindField('password')}
icon="key" icon="key"
color="darkBlue" color="darkBlue"
autoFocus autoFocus
onFocus={this.fixAutoFocus} onFocus={this.fixAutoFocus}
required required
placeholder={passwordChangedMessages.newPassword} placeholder={messages.currentPassword}
/>
<Input {...this.bindField('newPassword')}
icon="key"
color="darkBlue"
required
placeholder={messages.newPassword}
/> />
<Input {...this.bindField('newRePassword')} <Input {...this.bindField('newRePassword')}
icon="key" icon="key"
color="darkBlue" color="darkBlue"
required required
placeholder={passwordChangedMessages.newRePassword} placeholder={messages.newRePassword}
/> />
</div> </div>
); );
} }
} }
export default function PasswordChange() { export default function ChangePassword() {
const componentsMap = { const componentsMap = {
Title: () => ( // TODO: separate component for PageTitle Title: () => ( // TODO: separate component for PageTitle
<Message {...passwordChangedMessages.changePasswordTitle}> <Message {...messages.changePasswordTitle}>
{(msg) => <span>{msg}<Helmet title={msg} /></span>} {(msg) => <span>{msg}<Helmet title={msg} /></span>}
</Message> </Message>
), ),
Body, Body,
Footer: () => ( Footer: () => (
<button className={buttons.darkBlue} type="submit"> <button className={buttons.darkBlue} type="submit">
<Message {...passwordChangedMessages.change} /> <Message {...messages.change} />
</button> </button>
), ),
Links: (props, context) => ( Links: (props, context) => (
@ -67,7 +73,7 @@ export default function PasswordChange() {
context.reject(); context.reject();
}}> }}>
<Message {...passwordChangedMessages.skipThisStep} /> <Message {...messages.skipThisStep} />
</a> </a>
) )
}; };

View File

@ -17,6 +17,10 @@ export default defineMessages({
id: 'change', id: 'change',
defaultMessage: 'Change' defaultMessage: 'Change'
}, },
currentPassword: {
id: 'currentPassword',
defaultMessage: 'Enter current password'
},
newPassword: { newPassword: {
id: 'newPassword', id: 'newPassword',
defaultMessage: 'Enter new password' defaultMessage: 'Enter new password'

View File

@ -14,7 +14,7 @@ import Permissions from 'components/auth/permissions/Permissions';
import Activation from 'components/auth/activation/Activation'; import Activation from 'components/auth/activation/Activation';
import Password from 'components/auth/password/Password'; import Password from 'components/auth/password/Password';
import Logout from 'components/auth/Logout'; import Logout from 'components/auth/Logout';
import PasswordChange from 'components/auth/passwordChange/PasswordChange'; import ChangePassword from 'components/auth/changePassword/ChangePassword';
import ForgotPassword from 'components/auth/forgotPassword/ForgotPassword'; import ForgotPassword from 'components/auth/forgotPassword/ForgotPassword';
import Finish from 'components/auth/finish/Finish'; import Finish from 'components/auth/finish/Finish';
@ -47,7 +47,7 @@ export default function routesFactory(store) {
<Route path="/activation" components={new Activation()} {...onEnter} /> <Route path="/activation" components={new Activation()} {...onEnter} />
<Route path="/oauth/permissions" components={new Permissions()} {...onEnter} /> <Route path="/oauth/permissions" components={new Permissions()} {...onEnter} />
<Route path="/oauth/finish" component={Finish} {...onEnter} /> <Route path="/oauth/finish" component={Finish} {...onEnter} />
<Route path="/password-change" components={new PasswordChange()} {...onEnter} /> <Route path="/change-password" components={new ChangePassword()} {...onEnter} />
<Route path="/forgot-password" components={new ForgotPassword()} {...onEnter} /> <Route path="/forgot-password" components={new ForgotPassword()} {...onEnter} />
</Route> </Route>
</Route> </Route>

View File

@ -96,7 +96,7 @@ export default class AuthFlow {
case '/login': case '/login':
case '/password': case '/password':
case '/activation': case '/activation':
case '/password-change': case '/change-password':
case '/oauth/permissions': case '/oauth/permissions':
case '/oauth/finish': case '/oauth/finish':
this.setState(new LoginState()); this.setState(new LoginState());

View File

@ -3,7 +3,7 @@ import CompleteState from './CompleteState';
export default class ChangePasswordState extends AbstractState { export default class ChangePasswordState extends AbstractState {
enter(context) { enter(context) {
context.navigate('/password-change'); context.navigate('/change-password');
} }
reject(context) { reject(context) {