@@ -269,6 +269,21 @@ module.exports = React.createClass({
269
269
Lifecycle . initRtsClient ( this . props . config . teamServerConfig . teamServerURL ) ;
270
270
}
271
271
272
+ // if the user has followed a login or register link, don't reanimate
273
+ // the old creds, but rather go straight to the relevant page
274
+
275
+ const firstScreen = this . state . screenAfterLogin ?
276
+ this . state . screenAfterLogin . screen : null ;
277
+
278
+ if ( firstScreen === 'login' ||
279
+ firstScreen === 'register' ||
280
+ firstScreen === 'forgot_password' ) {
281
+ this . props . onLoadCompleted ( ) ;
282
+ this . setState ( { loading : false } ) ;
283
+ this . _showScreenAfterLogin ( ) ;
284
+ return ;
285
+ }
286
+
272
287
// the extra q() ensures that synchronous exceptions hit the same codepath as
273
288
// asynchronous ones.
274
289
q ( ) . then ( ( ) => {
@@ -840,14 +855,6 @@ module.exports = React.createClass({
840
855
_onLoadCompleted : function ( ) {
841
856
this . props . onLoadCompleted ( ) ;
842
857
this . setState ( { loading : false } ) ;
843
-
844
- // Show screens (like 'register') that need to be shown without _onLoggedIn
845
- // being called. 'register' needs to be routed here when the email confirmation
846
- // link is clicked on.
847
- if ( this . state . screenAfterLogin &&
848
- [ 'register' ] . indexOf ( this . state . screenAfterLogin . screen ) !== - 1 ) {
849
- this . _showScreenAfterLogin ( ) ;
850
- }
851
858
} ,
852
859
853
860
/**
@@ -946,6 +953,7 @@ module.exports = React.createClass({
946
953
this . state . screenAfterLogin . screen ,
947
954
this . state . screenAfterLogin . params ,
948
955
) ;
956
+ // XXX: is this necessary? `showScreen` should do it for us.
949
957
this . notifyNewScreen ( this . state . screenAfterLogin . screen ) ;
950
958
this . setState ( { screenAfterLogin : null } ) ;
951
959
} else if ( localStorage && localStorage . getItem ( 'mx_last_room_id' ) ) {
0 commit comments