adding verification view
This commit is contained in:
+42
-14
@@ -1078,8 +1078,7 @@
|
|||||||
this.state.login.trim(),
|
this.state.login.trim(),
|
||||||
this.state.password.trim(),
|
this.state.password.trim(),
|
||||||
vcard(this.state.fn, this.state.imageDataUrl),
|
vcard(this.state.fn, this.state.imageDataUrl),
|
||||||
null,
|
{"type": "email", "val": this.state.email});
|
||||||
to_tags({"email": this.state.email}));
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
@@ -1266,13 +1265,17 @@
|
|||||||
var avatar = false;
|
var avatar = false;
|
||||||
switch (this.props.state) {
|
switch (this.props.state) {
|
||||||
case 'login':
|
case 'login':
|
||||||
title = "Sign In"; break;
|
title = "Sign In";
|
||||||
|
break;
|
||||||
case 'register':
|
case 'register':
|
||||||
title = "Create Account"; break;
|
title = "Create Account";
|
||||||
|
break;
|
||||||
case 'settings':
|
case 'settings':
|
||||||
title = "Settings"; break;
|
title = "Settings";
|
||||||
|
break;
|
||||||
case 'edit-account':
|
case 'edit-account':
|
||||||
title = "Edit Account"; break;
|
title = "Edit Account";
|
||||||
|
break;
|
||||||
case 'contacts':
|
case 'contacts':
|
||||||
title = this.props.title;
|
title = this.props.title;
|
||||||
avatar = this.props.avatar ? this.props.avatar : true;
|
avatar = this.props.avatar ? this.props.avatar : true;
|
||||||
@@ -1280,6 +1283,9 @@
|
|||||||
case 'new-topic':
|
case 'new-topic':
|
||||||
title = "Start New Chat";
|
title = "Start New Chat";
|
||||||
break;
|
break;
|
||||||
|
case 'validation':
|
||||||
|
title = "Confirm Credentials";
|
||||||
|
break;
|
||||||
default:;
|
default:;
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
@@ -1339,6 +1345,9 @@
|
|||||||
onCreateTopic={this.props.onCreateTopic}
|
onCreateTopic={this.props.onCreateTopic}
|
||||||
onError={this.props.onError} /> :
|
onError={this.props.onError} /> :
|
||||||
|
|
||||||
|
this.props.state === 'validation' ?
|
||||||
|
<div><input type="text" /> [confirm]</div> :
|
||||||
|
|
||||||
null}
|
null}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -3460,7 +3469,8 @@
|
|||||||
contextMenuItems: [],
|
contextMenuItems: [],
|
||||||
serverVersion: 'no connection',
|
serverVersion: 'no connection',
|
||||||
contactsSearchQuery: '',
|
contactsSearchQuery: '',
|
||||||
foundContacts: []
|
foundContacts: [],
|
||||||
|
validation: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
@@ -3546,8 +3556,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (promise) {
|
if (promise) {
|
||||||
promise.then(function() {
|
promise.then(function(ctrl) {
|
||||||
instance.handleLoginSuccessful(instance);
|
console.log(ctrl);
|
||||||
|
if (ctrl.code >= 300 && ctrl.text === "validate credentials") {
|
||||||
|
instance.handleCredentialsRequest(ctrl.params);
|
||||||
|
} else {
|
||||||
|
instance.handleLoginSuccessful(instance);
|
||||||
|
}
|
||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
// Login failed, report error
|
// Login failed, report error
|
||||||
instance.setState({loginDisabled: false});
|
instance.setState({loginDisabled: false});
|
||||||
@@ -3556,6 +3571,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleCredentialsRequest: function(params) {
|
||||||
|
this.setState({
|
||||||
|
sidePanelSelected: 'validation',
|
||||||
|
validation: params.cred
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
handleLoginSuccessful: function(instance) {
|
handleLoginSuccessful: function(instance) {
|
||||||
instance.handleError("", null);
|
instance.handleError("", null);
|
||||||
|
|
||||||
@@ -3707,15 +3729,21 @@
|
|||||||
this.setState({sidePanelSelected: 'register'});
|
this.setState({sidePanelSelected: 'register'});
|
||||||
},
|
},
|
||||||
// Actual registration of a new account.
|
// Actual registration of a new account.
|
||||||
handleNewAccountRequest: function(login_, password_, public_, private_, tags_) {
|
handleNewAccountRequest: function(login_, password_, public_, cred_, tags_) {
|
||||||
var instance = this;
|
var instance = this;
|
||||||
tags_ = tags_ || []; // init tags_ value just in case undefined
|
|
||||||
Tinode.connect(this.state.serverAddress)
|
Tinode.connect(this.state.serverAddress)
|
||||||
.then(function() {
|
.then(function() {
|
||||||
|
if (cred_ && !Array.isArray(cred_)) {
|
||||||
|
cred_ = [cred_];
|
||||||
|
}
|
||||||
return Tinode.createAccountBasic(login_, password_,
|
return Tinode.createAccountBasic(login_, password_,
|
||||||
{public: public_, private: private_, tags: tags_});
|
{public: public_, cred: cred_, tags: tags_});
|
||||||
}).then(function() {
|
}).then(function(ctrl) {
|
||||||
instance.handleLoginSuccessful(instance);
|
if (ctrl.code >= 300 && ctrl.text === "validate credentials") {
|
||||||
|
instance.handleCredentialsRequest(ctrl.params);
|
||||||
|
} else {
|
||||||
|
instance.handleLoginSuccessful(instance);
|
||||||
|
}
|
||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
instance.handleError(err.message, "err");
|
instance.handleError(err.message, "err");
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user