mirror of
https://github.com/discourse/discourse-subscriptions.git
synced 2025-02-27 14:29:39 +00:00
remove second request to create user
This commit is contained in:
parent
c90245dce6
commit
13fe7ab7d5
@ -6,6 +6,10 @@ Accept donations in Discourse! Integrates with [Stripe](https://stripe.com).
|
|||||||
|
|
||||||
Note: Stripe requires HTTPS.
|
Note: Stripe requires HTTPS.
|
||||||
|
|
||||||
|
## Creating new user accounts
|
||||||
|
|
||||||
|
This is an experimental feature. A user can create a new account if there is a donation.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
* Follow the install instructions here: https://meta.discourse.org/t/install-a-plugin/19157
|
* Follow the install instructions here: https://meta.discourse.org/t/install-a-plugin/19157
|
||||||
@ -30,6 +34,5 @@ Visit `/admin/customize/site_texts` and search for 'discourse_donations'. You'll
|
|||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
* Donate when creating account
|
|
||||||
* Handle custom fields
|
* Handle custom fields
|
||||||
* Handle fails from stripe
|
* Handle fails from stripe
|
||||||
|
@ -48,26 +48,6 @@ export default Ember.Component.extend({
|
|||||||
this.set('result', this.get('result').concat(messages));
|
this.set('result', this.get('result').concat(messages));
|
||||||
},
|
},
|
||||||
|
|
||||||
createUser() {
|
|
||||||
let self = this;
|
|
||||||
ajax('/users/hp', { method: 'get' }).then(data => {
|
|
||||||
let params = {
|
|
||||||
email: self.get('email'),
|
|
||||||
username: self.get('username'),
|
|
||||||
name: self.get('name'),
|
|
||||||
password: self.get('password'),
|
|
||||||
password_confirmation: data.value,
|
|
||||||
challenge: data.challenge.split('').reverse().join(''),
|
|
||||||
};
|
|
||||||
|
|
||||||
ajax('/users', { data: params, method: 'post' }).then(data => {
|
|
||||||
self.setSuccess();
|
|
||||||
self.concatMessages(data.messages);
|
|
||||||
self.endTranscation();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
submitStripeCard() {
|
submitStripeCard() {
|
||||||
let self = this;
|
let self = this;
|
||||||
@ -93,25 +73,9 @@ export default Ember.Component.extend({
|
|||||||
if(!self.get('paymentSuccess')) {
|
if(!self.get('paymentSuccess')) {
|
||||||
ajax('/charges', { data: params, method: 'post' }).then(data => {
|
ajax('/charges', { data: params, method: 'post' }).then(data => {
|
||||||
self.concatMessages(data.messages);
|
self.concatMessages(data.messages);
|
||||||
|
self.endTranscation();
|
||||||
if(!this.get('create_accounts')) {
|
|
||||||
if(data.status == 'succeeded') { this.setSuccess() };
|
|
||||||
self.endTranscation();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(data.status == 'succeeded') {
|
|
||||||
this.createUser();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
self.endTranscation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (this.get('create_accounts')) {
|
|
||||||
self.set('result', []);
|
|
||||||
self.createUser();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user