mirror of https://github.com/vector-im/riot-web
				
				
				
			Merge pull request #977 from matrix-org/luke/session-store-null-on-logout
Remove cachedPassword from localStorage on_logged_outpull/21833/head
						commit
						7abaadddde
					
				| 
						 | 
					@ -24,6 +24,7 @@ import PageTypes from '../../PageTypes';
 | 
				
			||||||
import sdk from '../../index';
 | 
					import sdk from '../../index';
 | 
				
			||||||
import dis from '../../dispatcher';
 | 
					import dis from '../../dispatcher';
 | 
				
			||||||
import sessionStore from '../../stores/SessionStore';
 | 
					import sessionStore from '../../stores/SessionStore';
 | 
				
			||||||
 | 
					import MatrixClientPeg from '../../MatrixClientPeg';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * This is what our MatrixChat shows when we are logged in. The precise view is
 | 
					 * This is what our MatrixChat shows when we are logged in. The precise view is
 | 
				
			||||||
| 
						 | 
					@ -91,6 +92,16 @@ export default React.createClass({
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Child components assume that the client peg will not be null, so give them some
 | 
				
			||||||
 | 
					    // sort of assurance here by only allowing a re-render if the client is truthy.
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
 | 
					    // This is required because `LoggedInView` maintains its own state and if this state
 | 
				
			||||||
 | 
					    // updates after the client peg has been made null (during logout), then it will
 | 
				
			||||||
 | 
					    // attempt to re-render and the children will throw errors.
 | 
				
			||||||
 | 
					    shouldComponentUpdate: function() {
 | 
				
			||||||
 | 
					        return Boolean(MatrixClientPeg.get());
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    getScrollStateForRoom: function(roomId) {
 | 
					    getScrollStateForRoom: function(roomId) {
 | 
				
			||||||
        return this._scrollStateMap[roomId];
 | 
					        return this._scrollStateMap[roomId];
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -69,15 +69,13 @@ class SessionStore extends Store {
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case 'on_logged_out':
 | 
					            case 'on_logged_out':
 | 
				
			||||||
                this.reset();
 | 
					                this._setState({
 | 
				
			||||||
 | 
					                    cachedPassword: null,
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    reset() {
 | 
					 | 
				
			||||||
        this._state = Object.assign({}, INITIAL_STATE);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    getCachedPassword() {
 | 
					    getCachedPassword() {
 | 
				
			||||||
        return this._state.cachedPassword;
 | 
					        return this._state.cachedPassword;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue