aboutsummaryrefslogtreecommitdiff
path: root/src/components/registration/registration.js
diff options
context:
space:
mode:
authorlambda <pleromagit@rogerbraun.net>2018-11-13 18:42:07 +0000
committerlambda <pleromagit@rogerbraun.net>2018-11-13 18:42:07 +0000
commit11f8a4f312675a82d5fed9c5e75fed63a8456ffc (patch)
tree18c0c0d6d966ca23f4644638974613d75ba1c8fe /src/components/registration/registration.js
parente9b68b8c972e25df852543e9aa6670088bee06bb (diff)
parent9f64c96721028b2749f17cbf7bd910382ce58154 (diff)
Merge branch 'oauth' into 'develop'
Move login to oauth. See merge request pleroma/pleroma-fe!367
Diffstat (limited to 'src/components/registration/registration.js')
-rw-r--r--src/components/registration/registration.js22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/components/registration/registration.js b/src/components/registration/registration.js
index 8f59878d..f7f8a720 100644
--- a/src/components/registration/registration.js
+++ b/src/components/registration/registration.js
@@ -1,3 +1,5 @@
+import oauthApi from '../../services/new_api/oauth.js'
+
const registration = {
data: () => ({
user: {},
@@ -25,9 +27,23 @@ const registration = {
this.$store.state.api.backendInteractor.register(this.user).then(
(response) => {
if (response.ok) {
- this.$store.dispatch('loginUser', this.user)
- this.$router.push('/main/all')
- this.registering = false
+ const data = {
+ oauth: this.$store.state.oauth,
+ instance: this.$store.state.instance.server
+ }
+ oauthApi.getOrCreateApp(data).then((app) => {
+ oauthApi.getTokenWithCredentials(
+ {
+ app,
+ instance: data.instance,
+ username: this.user.username,
+ password: this.user.password})
+ .then((result) => {
+ this.$store.commit('setToken', result.access_token)
+ this.$store.dispatch('loginUser', result.access_token)
+ this.$router.push('/main/friends')
+ })
+ })
} else {
this.registering = false
response.json().then((data) => {