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) {
var newUrl = null;

View file

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

View file

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