explicitly set defacs for newly created account to “JRWPS”; add email as tags in newly created account, so it could be discovered by others;

This commit is contained in:
Riandy Rahman Nugraha
2017-08-03 09:15:31 +07:00
parent 578df160d1
commit d051c84737
2 changed files with 2759 additions and 4 deletions
+24 -4
View File
@@ -116,6 +116,15 @@
return card; return card;
} }
// construct email params
function email(emailAddress) {
var tags = [];
if(emailAddress) {
tags.push("email:" + emailAddress);
}
return tags
}
/* BEGIN Popup/dropdown menu */ /* BEGIN Popup/dropdown menu */
var ContextMenu = React.createClass({ var ContextMenu = React.createClass({
componentWillUnmount: function() { componentWillUnmount: function() {
@@ -650,6 +659,7 @@
login: '', login: '',
password: '', password: '',
password2: '', password2: '',
email: '',
fn: '', // full/formatted name fn: '', // full/formatted name
imageDataUrl: null, imageDataUrl: null,
errorCleared: false errorCleared: false
@@ -664,6 +674,9 @@
handlePassword2Change: function(e) { handlePassword2Change: function(e) {
this.setState({password2: e.target.value}); this.setState({password2: e.target.value});
}, },
handleEmailChange: function(e) {
this.setState({email: e.target.value})
},
handleFnChange: function(e) { handleFnChange: function(e) {
this.setState({fn: e.target.value}); this.setState({fn: e.target.value});
}, },
@@ -679,7 +692,9 @@
this.props.onCreateAccount( this.props.onCreateAccount(
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,
email(this.state.email));
} }
}, },
render: function() { render: function() {
@@ -700,9 +715,13 @@
</div> </div>
<AvatarUpload onImageChanged={this.handleImageChanged} /> <AvatarUpload onImageChanged={this.handleImageChanged} />
</div> </div>
<div className="panel-form-row">
<input type="text" placeholder="Email, e.g john.doe@example.com"
value={this.state.email} onChange={this.handleEmailChange} required/>
</div>
<div className="panel-form-row"> <div className="panel-form-row">
<input type="text" placeholder="Full name, e.g. John Doe" <input type="text" placeholder="Full name, e.g. John Doe"
value={this.state.fn} onChange={this.handleFnChange} /> value={this.state.fn} onChange={this.handleFnChange} required/>
</div> </div>
<div className="dialog-buttons"> <div className="dialog-buttons">
<button className={submitClasses} onClick={this.handleSubmit}>Sign up</button> <button className={submitClasses} onClick={this.handleSubmit}>Sign up</button>
@@ -2502,12 +2521,13 @@
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_) { handleNewAccountRequest: function(login_, password_, public_, private_, 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() {
return Tinode.createAccountBasic(login_, password_, return Tinode.createAccountBasic(login_, password_,
{login: true, public: public_, private: private_}); {defacs: {auth: "JRWPS", anon: "N"}, public: public_, private: private_, tags: tags_});
}) })
.then(function() { .then(function() {
instance.handleLoginSuccessful(instance); instance.handleLoginSuccessful(instance);
Executable
+2735
View File
File diff suppressed because it is too large Load Diff