member signin redirect
This commit is contained in:
parent
ff2b542aff
commit
989dff32bb
|
@ -11,6 +11,7 @@ import SignIn from '../member/SignIn';
|
||||||
import SignUp from '../member/SignUp';
|
import SignUp from '../member/SignUp';
|
||||||
import EmailConfirm from '../member/EmailConfirm';
|
import EmailConfirm from '../member/EmailConfirm';
|
||||||
import ForgotPassword from '../member/ForgotPassword';
|
import ForgotPassword from '../member/ForgotPassword';
|
||||||
|
import PWConfirm from '../member/PWConfirm';
|
||||||
|
|
||||||
export interface Props extends RouteComponentProps<any> {
|
export interface Props extends RouteComponentProps<any> {
|
||||||
}
|
}
|
||||||
|
@ -36,6 +37,7 @@ class AccountLayout extends React.Component<Props, State> {
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path={`${this.props.match.url}/signin`} component={SignIn}/>
|
<Route path={`${this.props.match.url}/signin`} component={SignIn}/>
|
||||||
<Route path={`${this.props.match.url}/signup`} component={SignUp}/>
|
<Route path={`${this.props.match.url}/signup`} component={SignUp}/>
|
||||||
|
<Route path={`${this.props.match.url}/pw_confirm`} component={PWConfirm}/>
|
||||||
<Route path={`${this.props.match.url}/check_email`} component={EmailConfirm}/>
|
<Route path={`${this.props.match.url}/check_email`} component={EmailConfirm}/>
|
||||||
<Route path={`${this.props.match.url}/forgot_password`} component={ForgotPassword}/>
|
<Route path={`${this.props.match.url}/forgot_password`} component={ForgotPassword}/>
|
||||||
</Switch>
|
</Switch>
|
||||||
|
|
|
@ -120,6 +120,9 @@ class LeftMenu extends React.Component<Props, State> {
|
||||||
<Menu.Item onClick={(e) => this.props.onChangeUrl('/account/signup')} style={{ 'marginLeft': '30px' }}>
|
<Menu.Item onClick={(e) => this.props.onChangeUrl('/account/signup')} style={{ 'marginLeft': '30px' }}>
|
||||||
Sign Up
|
Sign Up
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
<Menu.Item onClick={(e) => this.props.onChangeUrl('/account/pw_confirm')} style={{ 'marginLeft': '30px' }}>
|
||||||
|
PW Confirm
|
||||||
|
</Menu.Item>
|
||||||
<Menu.Item onClick={(e) => this.props.onChangeUrl('/account/logout')} style={{ 'marginLeft': '30px' }}>
|
<Menu.Item onClick={(e) => this.props.onChangeUrl('/account/logout')} style={{ 'marginLeft': '30px' }}>
|
||||||
Log Out
|
Log Out
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
|
26
src/ts/@overflow/app/views/member/PWConfirm.tsx
Normal file
26
src/ts/@overflow/app/views/member/PWConfirm.tsx
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
import * as React from 'react';
|
||||||
|
import { RouteComponentProps } from 'react-router';
|
||||||
|
import PWConfirmContainer from '@overflow/member/react/PWConfirm';
|
||||||
|
|
||||||
|
export interface Props {
|
||||||
|
}
|
||||||
|
export interface State {
|
||||||
|
}
|
||||||
|
|
||||||
|
class PWConfirm extends React.Component<RouteComponentProps<Props>, object> {
|
||||||
|
|
||||||
|
public constructor(props?: RouteComponentProps<Props>, context?: State) {
|
||||||
|
super(props, context);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public render(): JSX.Element {
|
||||||
|
return (
|
||||||
|
<PWConfirmContainer/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export default PWConfirm;
|
28
src/ts/@overflow/member/react/PWConfirm.tsx
Normal file
28
src/ts/@overflow/member/react/PWConfirm.tsx
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import { connect, Dispatch } from 'react-redux';
|
||||||
|
import {
|
||||||
|
PWConfirm,
|
||||||
|
StateProps as PWConfirmStateProps,
|
||||||
|
DispatchProps as PWConfirmDispatchProps,
|
||||||
|
Props as PWConfirmProps,
|
||||||
|
} from './components/PWConfirm';
|
||||||
|
import PWConfirmState from '../redux/state/PWConfirm';
|
||||||
|
|
||||||
|
import * as PWConfirmActions from '../redux/action/pw_confirm';
|
||||||
|
import { push as routerPush } from 'react-router-redux';
|
||||||
|
import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest';
|
||||||
|
export function mapStateToProps(state: any): PWConfirmStateProps {
|
||||||
|
return {
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function mapDispatchToProps(dispatch: Dispatch<any>): PWConfirmDispatchProps {
|
||||||
|
return {
|
||||||
|
// Todo SessionId put
|
||||||
|
onConfirmPassword: (pass: string) => {
|
||||||
|
dispatch(asyncRequestActions.request('MemberService', 'signin', PWConfirmActions.REQUEST, 'overflow@loafle.com', pass));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(PWConfirm);
|
|
@ -12,8 +12,10 @@ import { push as routerPush } from 'react-router-redux';
|
||||||
import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest';
|
import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest';
|
||||||
|
|
||||||
export function mapStateToProps(state: SignInState, ownProps?: SignInStateProps): SignInStateProps {
|
export function mapStateToProps(state: SignInState, ownProps?: SignInStateProps): SignInStateProps {
|
||||||
|
console.log(state.error);
|
||||||
return {
|
return {
|
||||||
isAuthenticated: state.isAuthenticated,
|
isAuthenticated: state.isAuthenticated,
|
||||||
|
error:state.error,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
52
src/ts/@overflow/member/react/components/PWConfirm.tsx
Normal file
52
src/ts/@overflow/member/react/components/PWConfirm.tsx
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
import *as React from 'react';
|
||||||
|
import {
|
||||||
|
Input,
|
||||||
|
InputOnChangeData,
|
||||||
|
Button,
|
||||||
|
Form,
|
||||||
|
ButtonProps,
|
||||||
|
} from 'semantic-ui-react';
|
||||||
|
|
||||||
|
export interface StateProps {
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DispatchProps {
|
||||||
|
onConfirmPassword?(pass:string):void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Props = StateProps & DispatchProps;
|
||||||
|
|
||||||
|
export interface State {
|
||||||
|
pass: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class PWConfirm extends React.Component<Props, State> {
|
||||||
|
constructor(props: Props, context: State) {
|
||||||
|
super(props, context);
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
pass:null,
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public render(): JSX.Element {
|
||||||
|
return (
|
||||||
|
<Form>
|
||||||
|
<Form.Input placeholder='Password' type='password' onChange={
|
||||||
|
(event: React.SyntheticEvent<HTMLInputElement>, data: InputOnChangeData) => {
|
||||||
|
this.setState({ pass: data.value });
|
||||||
|
}} />
|
||||||
|
<Form.Group>
|
||||||
|
<Button primary fluid style={{margin:'7'}} onClick={this.PWConfirmClick}> Submit </Button>
|
||||||
|
<Button fluid style={{margin:'7'}}> Cancel </Button>
|
||||||
|
</Form.Group>
|
||||||
|
</Form>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PWConfirmClick(event: React.SyntheticEvent<HTMLButtonElement>, data: ButtonProps):void {
|
||||||
|
this.props.onConfirmPassword(this.state.pass);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ const options = [
|
||||||
];
|
];
|
||||||
export interface StateProps {
|
export interface StateProps {
|
||||||
isAuthenticated?:boolean;
|
isAuthenticated?:boolean;
|
||||||
|
error?:Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DispatchProps {
|
export interface DispatchProps {
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
import Action from '@overflow/commons/redux/Action';
|
|
||||||
import Member from '@overflow/member/api/model/Member';
|
|
||||||
|
|
||||||
import ModifyPayload from '../payload/ModifyPayload';
|
|
||||||
|
|
||||||
// Action Type
|
// Action Type
|
||||||
export type REQUEST = '@overflow/member/modify/REQUEST';
|
export type REQUEST = '@overflow/member/modify/REQUEST';
|
||||||
|
@ -12,30 +8,3 @@ export const REQUEST: REQUEST = '@overflow/member/modify/REQUEST';
|
||||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/member/modify/REQUEST_SUCCESS';
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/member/modify/REQUEST_SUCCESS';
|
||||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/member/modify/REQUEST_FAILURE';
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/member/modify/REQUEST_FAILURE';
|
||||||
|
|
||||||
// Action Creater
|
|
||||||
export type request = (member: Member) => Action<ModifyPayload>;
|
|
||||||
export type requestSuccess = (member: Member) => Action<Member>;
|
|
||||||
export type requestFailure = (error: Error) => Action;
|
|
||||||
|
|
||||||
export const request: request = (member: Member): Action<ModifyPayload> => {
|
|
||||||
return {
|
|
||||||
type: REQUEST,
|
|
||||||
payload: {
|
|
||||||
member: member,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const requestSuccess: requestSuccess = (member: Member): Action<Member> => {
|
|
||||||
return {
|
|
||||||
type: REQUEST_SUCCESS,
|
|
||||||
payload: member,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const requestFailure: requestFailure = (error: Error): Action => {
|
|
||||||
return {
|
|
||||||
type: REQUEST_FAILURE,
|
|
||||||
error: error,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
import Action from '@overflow/commons/redux/Action';
|
|
||||||
import Member from '@overflow/member/api/model/Member';
|
|
||||||
|
|
||||||
import PWChangePayload from '../payload/PWChangePayload';
|
|
||||||
|
|
||||||
// Action Type
|
// Action Type
|
||||||
export type REQUEST = '@overflow/member/pw_change/REQUEST';
|
export type REQUEST = '@overflow/member/pw_change/REQUEST';
|
||||||
export type REQUEST_SUCCESS = '@overflow/member/pw_change/REQUEST_SUCCESS';
|
export type REQUEST_SUCCESS = '@overflow/member/pw_change/REQUEST_SUCCESS';
|
||||||
|
@ -12,30 +7,3 @@ export const REQUEST: REQUEST = '@overflow/member/pw_change/REQUEST';
|
||||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/member/pw_change/REQUEST_SUCCESS';
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/member/pw_change/REQUEST_SUCCESS';
|
||||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/member/pw_change/REQUEST_FAILURE';
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/member/pw_change/REQUEST_FAILURE';
|
||||||
|
|
||||||
// Action Creater
|
|
||||||
export type request = (pass: string) => Action<PWChangePayload>;
|
|
||||||
export type requestSuccess = (member: Member) => Action<Member>;
|
|
||||||
export type requestFailure = (error: Error) => Action;
|
|
||||||
|
|
||||||
export const request: request = (pass: string): Action<PWChangePayload> => {
|
|
||||||
return {
|
|
||||||
type: REQUEST,
|
|
||||||
payload: {
|
|
||||||
pass: pass,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const requestSuccess: requestSuccess = (member: Member): Action<Member> => {
|
|
||||||
return {
|
|
||||||
type: REQUEST_SUCCESS,
|
|
||||||
payload: member,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const requestFailure: requestFailure = (error: Error): Action => {
|
|
||||||
return {
|
|
||||||
type: REQUEST_FAILURE,
|
|
||||||
error: error,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
9
src/ts/@overflow/member/redux/action/pw_confirm.ts
Normal file
9
src/ts/@overflow/member/redux/action/pw_confirm.ts
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/member/pw_confirm/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/member/pw_confirm/REQUEST_SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/member/pw_confirm/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/member/pw_confirm/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/member/pw_confirm/REQUEST_SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/member/pw_confirm/REQUEST_FAILURE';
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
import Action from '@overflow/commons/redux/Action';
|
|
||||||
import Member from '@overflow/member/api/model/Member';
|
|
||||||
|
|
||||||
import ReadPayload from '../payload/ReadPayload';
|
|
||||||
|
|
||||||
// Action Type
|
// Action Type
|
||||||
export type REQUEST = '@overflow/member/read/REQUEST';
|
export type REQUEST = '@overflow/member/read/REQUEST';
|
||||||
|
@ -12,30 +8,3 @@ export const REQUEST: REQUEST = '@overflow/member/read/REQUEST';
|
||||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/member/read/REQUEST_SUCCESS';
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/member/read/REQUEST_SUCCESS';
|
||||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/member/read/REQUEST_FAILURE';
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/member/read/REQUEST_FAILURE';
|
||||||
|
|
||||||
// Action Creater
|
|
||||||
export type request = (id: number) => Action<ReadPayload>;
|
|
||||||
export type requestSuccess = (member: Member) => Action<Member>;
|
|
||||||
export type requestFailure = (error: Error) => Action;
|
|
||||||
|
|
||||||
export const request: request = (id: number): Action<ReadPayload> => {
|
|
||||||
return {
|
|
||||||
type: REQUEST,
|
|
||||||
payload: {
|
|
||||||
id: id,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const requestSuccess: requestSuccess = (member: Member): Action<Member> => {
|
|
||||||
return {
|
|
||||||
type: REQUEST_SUCCESS,
|
|
||||||
payload: member,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const requestFailure: requestFailure = (error: Error): Action => {
|
|
||||||
return {
|
|
||||||
type: REQUEST_FAILURE,
|
|
||||||
error: error,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import Action from '@overflow/commons/redux/Action';
|
|
||||||
|
|
||||||
// Action Type
|
// Action Type
|
||||||
export type REQUEST = '@overflow/member/signout/REQUEST';
|
export type REQUEST = '@overflow/member/signout/REQUEST';
|
||||||
|
@ -8,27 +7,3 @@ export type REQUEST_FAILURE = '@overflow/member/signout/REQUEST_FAILURE';
|
||||||
export const REQUEST: REQUEST = '@overflow/member/signout/REQUEST';
|
export const REQUEST: REQUEST = '@overflow/member/signout/REQUEST';
|
||||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/member/signout/REQUEST_SUCCESS';
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/member/signout/REQUEST_SUCCESS';
|
||||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/member/signout/REQUEST_FAILURE';
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/member/signout/REQUEST_FAILURE';
|
||||||
|
|
||||||
// Action Creater
|
|
||||||
export type request = () => Action;
|
|
||||||
export type requestSuccess = () => Action;
|
|
||||||
export type requestFailure = (error: Error) => Action;
|
|
||||||
|
|
||||||
export const request: request = (): Action => {
|
|
||||||
return {
|
|
||||||
type: REQUEST,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const requestSuccess: requestSuccess = (): Action => {
|
|
||||||
return {
|
|
||||||
type: REQUEST_SUCCESS,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const requestFailure: requestFailure = (error: Error): Action => {
|
|
||||||
return {
|
|
||||||
type: REQUEST_FAILURE,
|
|
||||||
error: error,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
import Member from '../../api/model/Member';
|
||||||
|
interface PWConfirmPayload {
|
||||||
|
pass: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PWConfirmPayload;
|
26
src/ts/@overflow/member/redux/reducer/pwConfirm.ts
Normal file
26
src/ts/@overflow/member/redux/reducer/pwConfirm.ts
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
import { ReducersMapObject } from 'redux';
|
||||||
|
import Member from '@overflow/member/api/model/Member';
|
||||||
|
|
||||||
|
import * as PWConfirmActionTypes from '../action/signIn';
|
||||||
|
import PWConfirmState, { defaultState as pwConfirmDefaultState } from '../state/PWConfirm';
|
||||||
|
|
||||||
|
const reducer: ReducersMapObject = {
|
||||||
|
[PWConfirmActionTypes.REQUEST_SUCCESS]: (state: PWConfirmState = pwConfirmDefaultState, action: Action<Member>): PWConfirmState => {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
isPWConfirm: true,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
[PWConfirmActionTypes.REQUEST_FAILURE]: (state: PWConfirmState = pwConfirmDefaultState, action: Action<Error>): PWConfirmState => {
|
||||||
|
if (action.error.name === 'SignInPwNotMatchException') {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
error: new Error(action.error.name),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default reducer;
|
|
@ -16,7 +16,10 @@ const reducer: ReducersMapObject = {
|
||||||
if (action.error.name === 'SignInPwNotMatchException') {
|
if (action.error.name === 'SignInPwNotMatchException') {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
return state;
|
return {
|
||||||
|
...state,
|
||||||
|
error: new Error('SigninIdPwNotMatch'),
|
||||||
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
14
src/ts/@overflow/member/redux/state/PWConfirm.ts
Normal file
14
src/ts/@overflow/member/redux/state/PWConfirm.ts
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import Member from '../../api/model/Member';
|
||||||
|
|
||||||
|
export interface State {
|
||||||
|
readonly isPWConfirm: boolean;
|
||||||
|
readonly error?: Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const defaultState: State = {
|
||||||
|
isPWConfirm: undefined,
|
||||||
|
error: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default State;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user