Merge pull request #35 from matrix-org/kegan/post-register

Re-add in post registration steps
This commit is contained in:
Kegsay 2015-11-20 15:06:14 +00:00
commit 4e01d27f7b
3 changed files with 32 additions and 8 deletions

View file

@ -36,6 +36,16 @@ module.exports = {
} }
}, },
componentWillReceiveProps: function(newProps) {
if (this.avatarSet) {
// don't clobber what the user has just set
return;
}
this.setState({
avatarUrl: newProps.initialAvatarUrl
});
},
setAvatarFromFile: function(file) { setAvatarFromFile: function(file) {
var newUrl = null; var newUrl = null;

View file

@ -15,10 +15,14 @@ limitations under the License.
*/ */
'use strict'; 'use strict';
var React = require('react');
var MatrixClientPeg = require("../../MatrixClientPeg"); var MatrixClientPeg = require("../../MatrixClientPeg");
module.exports = { module.exports = {
propTypes: {
onFinished: React.PropTypes.func
},
getDefaultProps: function() { getDefaultProps: function() {
return { return {
onFinished: function() {}, onFinished: function() {},

View file

@ -144,6 +144,11 @@ module.exports = {
}); });
this.notifyNewScreen('login'); this.notifyNewScreen('login');
break; break;
case 'start_post_registration':
this.setState({ // don't clobber logged_in status
screen: 'post_registration'
});
break;
case 'token_login': case 'token_login':
if (this.state.logged_in) return; if (this.state.logged_in) return;
@ -298,13 +303,11 @@ module.exports = {
}, },
onLoggedIn: function(credentials) { onLoggedIn: function(credentials) {
if (credentials) { // registration doesn't do this yet console.log("onLoggedIn => %s", credentials.userId);
console.log("onLoggedIn => %s", credentials.userId); MatrixClientPeg.replaceUsingAccessToken(
MatrixClientPeg.replaceUsingAccessToken( credentials.homeserverUrl, credentials.identityServerUrl,
credentials.homeserverUrl, credentials.identityServerUrl, credentials.userId, credentials.accessToken
credentials.userId, credentials.accessToken );
);
}
this.setState({ this.setState({
screen: undefined, screen: undefined,
logged_in: true logged_in: true
@ -431,6 +434,10 @@ module.exports = {
dis.dispatch({ dis.dispatch({
action: 'view_room_directory', action: 'view_room_directory',
}); });
} else if (screen == 'post_registration') {
dis.dispatch({
action: 'start_post_registration',
});
} else if (screen.indexOf('room/') == 0) { } else if (screen.indexOf('room/') == 0) {
var roomString = screen.split('/')[1]; var roomString = screen.split('/')[1];
if (roomString[0] == '#') { if (roomString[0] == '#') {
@ -452,6 +459,9 @@ module.exports = {
}); });
} }
} }
else {
console.error("Unknown screen : %s", screen);
}
}, },
notifyNewScreen: function(screen) { notifyNewScreen: function(screen) {