Skip to content

Commit

Permalink
add account and site info after registration
Browse files Browse the repository at this point in the history
  • Loading branch information
denisskin committed Aug 4, 2015

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 4fc978f commit 8cf1ae0
Showing 2 changed files with 31 additions and 4 deletions.
18 changes: 16 additions & 2 deletions app-core/Application.jsx
Original file line number Diff line number Diff line change
@@ -51,7 +51,6 @@ var Application = $class({
<h4>{transl("Account")}</h4>
{cert.isAnonymous() ?
<div>
reg-step1
</div>
:
<div>
@@ -98,7 +97,7 @@ var Application = $class({

init: function() {
var cert = base.Accounts.getCurrentCertificate();
cert.rsign || cert.loadRegistrationInfo(function(err) {
cert.rsign && cert.name || cert.loadRegistrationInfo(function(err) {
this.setState({
error: err,
loading: false
@@ -148,6 +147,21 @@ var Application = $class({
}
},

setAccountInfo: function(info) {
var cert = base.Accounts.getCurrentCertificate();
info.name = info.name || cert.name;
base.core.postData({
storage: "D",
ring: 1,
uid: cert.pub,
data: info // <- {name, icon, ...}
}, function(err){
if(err) return this.setState({ success: transl("Setting of account info has been failed."), progress: null });

this.setState({ success: transl("Account has been successfully registered."), progress: null });
}.bind(this));
},

//-------------- static methods ----------------------------
statics: {
//siteInfo: baseAPI.getCurrentSiteInfo(),
17 changes: 15 additions & 2 deletions app-core/RegistrationForm.jsx
Original file line number Diff line number Diff line change
@@ -139,8 +139,21 @@ var RegistrationForm = $class({
var data = packs[0].data;
var _cert = base.Certificate.parsePublicCertificate(data.owner);
if(cert.pub == _cert.pub) {
this.setState({ success: transl("Account has been successfully registered."), progress: null });
//setTimeout(application.reloadPage, 3559);
this.setState({ progress: this.state.progress + 1 });

// set site info (title, js-engine)
base.core.postData({
storage: "D",
ring: 1,
uid: domain,
data: {
title: name
}
}, function(err){
if(err) return this.setState({ success: transl("Setting of account info has been failed."), progress: null });

this.setState({ success: transl("Account has been successfully registered."), progress: null });
}.bind(this));

} else {
this.setState({ error: transl("Domain is already registered by another person."), progress: null });

0 comments on commit 8cf1ae0

Please sign in to comment.