Add combined token support

This commit is contained in:
James Rowe 2019-11-14 14:41:29 -07:00
parent 6845ed9ad7
commit 30f817e4fa

View File

@ -2,7 +2,7 @@
<div class="column has-padding">
<b-message type="is-info" :active.sync="browser_opened">
Page opened! Check your default browser for the page, and follow the instructions there to link your patreon account.
When you are done, enter the username and token below.
When you are done, enter the token below.
</b-message>
<b-message type="is-info" :active.sync="show_header">
The <strong>Early Access</strong> release channel lets you try out the latest experimental features and fixes, before they are merged into yuzu. This channel includes all regular yuzu daily updates, plus these exclusive features.
@ -16,20 +16,21 @@
</div>
<br>
<div class="control">
<label for="username">Username</label>
<input class="input" type="text" v-model="$root.$data.username" placeholder="Username" id="username">
</div>
<div class="control">
<label for="token">Token</label>
<input class="input" type="password" v-model="$root.$data.token" placeholder="Token" id="token">
<input class="input" type="text" v-model="combined_token" placeholder="Token" id="token">
</div>
<br>
<b-message type="is-danger" :active.sync="invalid_token">
Login failed!
Double check that your token is correct and try again
</b-message>
<b-message type="is-danger" :active.sync="invalid_login">
Login failed!
Double check that your username and token are correct and try again
Double check that your token is correct and try again
</b-message>
<b-message type="is-danger" :active.sync="unlinked_patreon">
@ -75,11 +76,12 @@ export default {
return {
browser_opened: false,
verification_opened: false,
invalid_token: false,
}
},
computed: {
show_header: function() {
return !this.browser_opened && !this.verification_opened;
return !this.browser_opened && !this.verification_opened && !this.invalid_token;
},
invalid_login: function() {
return this.verification_opened && !this.$root.is_authenticated;
@ -92,6 +94,26 @@ export default {
},
tier_not_selected: function() {
return this.verification_opened && this.$root.is_linked && this.$root.is_subscribed && !this.$root.has_reward_tier;
},
combined_token: {
// getter
get: function () {
if (this.$root.$data.username && this.$root.$data.token) {
return btoa(this.$root.$data.username + ":" + this.$root.$data.token)
}
return "";
},
// setter
set: function (newValue) {
try {
var split = atob(newValue).split(':')
this.$root.$data.username = split[0];
this.$root.$data.token = split[1];
this.invalid_token = false;
} catch (e) {
this.invalid_token = true;
}
}
}
},
methods: {