mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 16:24:45 -07:00
Webatrice: fix saved password (#4563)
* fix saved label, and fix using hashedPassword when Save is unchecked * update host only after successful login * cleanup * fix ability to deselect saved password on successful login * cleanup * clear options after connection * fix registration saved username * cleanup * change label * fix tests Co-authored-by: Jeremy Letto <jeremy.letto@datasite.com>
This commit is contained in:
parent
9577ada171
commit
2a54e9d7d1
15 changed files with 170 additions and 169 deletions
|
|
@ -105,8 +105,9 @@ export const Actions = {
|
|||
type: Types.REGISTRATION_USERNAME_ERROR,
|
||||
error
|
||||
}),
|
||||
accountAwaitingActivation: () => ({
|
||||
accountAwaitingActivation: (options: WebSocketConnectOptions) => ({
|
||||
type: Types.ACCOUNT_AWAITING_ACTIVATION,
|
||||
options
|
||||
}),
|
||||
accountActivationSuccess: () => ({
|
||||
type: Types.ACCOUNT_ACTIVATION_SUCCESS,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { reset } from 'redux-form';
|
||||
import { Actions } from './server.actions';
|
||||
import { store } from 'store';
|
||||
import { WebSocketConnectOptions } from 'types';
|
||||
|
||||
export const Dispatch = {
|
||||
initialized: () => {
|
||||
|
|
@ -92,8 +93,8 @@ export const Dispatch = {
|
|||
registrationUserNameError: (error) => {
|
||||
store.dispatch(Actions.registrationUserNameError(error));
|
||||
},
|
||||
accountAwaitingActivation: () => {
|
||||
store.dispatch(Actions.accountAwaitingActivation());
|
||||
accountAwaitingActivation: (options: WebSocketConnectOptions) => {
|
||||
store.dispatch(Actions.accountAwaitingActivation(options));
|
||||
},
|
||||
accountActivationSuccess: () => {
|
||||
store.dispatch(Actions.accountActivationSuccess());
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Log, SortBy, User, UserSortField } from 'types';
|
||||
import { Log, SortBy, User, UserSortField, WebSocketConnectOptions } from 'types';
|
||||
|
||||
export interface ServerConnectParams {
|
||||
host: string;
|
||||
|
|
@ -48,6 +48,7 @@ export interface ServerState {
|
|||
user: User;
|
||||
users: User[];
|
||||
sortUsersBy: ServerStateSortUsersBy;
|
||||
connectOptions: WebSocketConnectOptions;
|
||||
}
|
||||
|
||||
export interface ServerStateStatus {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@ const initialState: ServerState = {
|
|||
sortUsersBy: {
|
||||
field: UserSortField.NAME,
|
||||
order: SortDirection.ASC
|
||||
}
|
||||
},
|
||||
connectOptions: {},
|
||||
};
|
||||
|
||||
export const serverReducer = (state = initialState, action: any) => {
|
||||
|
|
@ -40,6 +41,21 @@ export const serverReducer = (state = initialState, action: any) => {
|
|||
initialized: true
|
||||
}
|
||||
}
|
||||
case Types.ACCOUNT_AWAITING_ACTIVATION: {
|
||||
return {
|
||||
...state,
|
||||
connectOptions: {
|
||||
...action.options
|
||||
}
|
||||
}
|
||||
}
|
||||
case Types.ACCOUNT_ACTIVATION_FAILED:
|
||||
case Types.ACCOUNT_ACTIVATION_SUCCESS: {
|
||||
return {
|
||||
...state,
|
||||
connectOptions: {}
|
||||
}
|
||||
}
|
||||
case Types.CLEAR_STORE: {
|
||||
return {
|
||||
...initialState,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ interface State {
|
|||
|
||||
export const Selectors = {
|
||||
getInitialized: ({ server }: State) => server.initialized,
|
||||
getConnectOptions: ({ server }: State) => server.connectOptions,
|
||||
getMessage: ({ server }: State) => server.info.message,
|
||||
getName: ({ server }: State) => server.info.name,
|
||||
getVersion: ({ server }: State) => server.info.version,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue