forked from AkkomaGang/akkoma-fe
the missing piece for invites system
This commit is contained in:
parent
32fd108e97
commit
9cebb00faa
5 changed files with 18 additions and 4 deletions
|
@ -5,17 +5,23 @@ const registration = {
|
||||||
registering: false
|
registering: false
|
||||||
}),
|
}),
|
||||||
created () {
|
created () {
|
||||||
if (!this.$store.state.config.registrationOpen || !!this.$store.state.users.currentUser) {
|
if ((!this.$store.state.config.registrationOpen && !this.token) || !!this.$store.state.users.currentUser) {
|
||||||
this.$router.push('/main/all')
|
this.$router.push('/main/all')
|
||||||
}
|
}
|
||||||
|
// Seems like this doesn't work at first page open for some reason
|
||||||
|
if (this.$store.state.config.registrationOpen && this.token) {
|
||||||
|
this.$router.push('/registration')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
termsofservice () { return this.$store.state.config.tos }
|
termsofservice () { return this.$store.state.config.tos },
|
||||||
|
token () { return this.$route.params.token }
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
submit () {
|
submit () {
|
||||||
this.registering = true
|
this.registering = true
|
||||||
this.user.nickname = this.user.username
|
this.user.nickname = this.user.username
|
||||||
|
this.user.token = this.token
|
||||||
this.$store.state.api.backendInteractor.register(this.user).then(
|
this.$store.state.api.backendInteractor.register(this.user).then(
|
||||||
(response) => {
|
(response) => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
|
|
|
@ -38,6 +38,10 @@
|
||||||
<input :disabled="registering" v-model='user.captcha' placeholder='Enter captcha' type='test' class='form-control' id='captcha'>
|
<input :disabled="registering" v-model='user.captcha' placeholder='Enter captcha' type='test' class='form-control' id='captcha'>
|
||||||
</div>
|
</div>
|
||||||
-->
|
-->
|
||||||
|
<div class='form-group' v-if='token' >
|
||||||
|
<label for='token'>{{$t('registration.token')}}</label>
|
||||||
|
<input disabled='true' v-model='token' class='form-control' id='token' type='text'>
|
||||||
|
</div>
|
||||||
<div class='form-group'>
|
<div class='form-group'>
|
||||||
<button :disabled="registering" type='submit' class='btn btn-default'>{{$t('general.submit')}}</button>
|
<button :disabled="registering" type='submit' class='btn btn-default'>{{$t('general.submit')}}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -354,7 +354,8 @@ const en = {
|
||||||
fullname: 'Display name',
|
fullname: 'Display name',
|
||||||
email: 'Email',
|
email: 'Email',
|
||||||
bio: 'Bio',
|
bio: 'Bio',
|
||||||
password_confirm: 'Password confirmation'
|
password_confirm: 'Password confirmation',
|
||||||
|
token: 'Invite token'
|
||||||
},
|
},
|
||||||
post_status: {
|
post_status: {
|
||||||
posting: 'Posting',
|
posting: 'Posting',
|
||||||
|
@ -1643,7 +1644,8 @@ const ru = {
|
||||||
fullname: 'Отображаемое имя',
|
fullname: 'Отображаемое имя',
|
||||||
email: 'Email',
|
email: 'Email',
|
||||||
bio: 'Описание',
|
bio: 'Описание',
|
||||||
password_confirm: 'Подтверждение пароля'
|
password_confirm: 'Подтверждение пароля',
|
||||||
|
token: 'Код приглашения'
|
||||||
},
|
},
|
||||||
post_status: {
|
post_status: {
|
||||||
posting: 'Отправляется',
|
posting: 'Отправляется',
|
||||||
|
|
|
@ -119,6 +119,7 @@ window.fetch('/static/config.json')
|
||||||
{ name: 'mentions', path: '/:username/mentions', component: Mentions },
|
{ name: 'mentions', path: '/:username/mentions', component: Mentions },
|
||||||
{ name: 'settings', path: '/settings', component: Settings },
|
{ name: 'settings', path: '/settings', component: Settings },
|
||||||
{ name: 'registration', path: '/registration', component: Registration },
|
{ name: 'registration', path: '/registration', component: Registration },
|
||||||
|
{ name: 'registration', path: '/registration/:token', component: Registration },
|
||||||
{ name: 'friend-requests', path: '/friend-requests', component: FollowRequests },
|
{ name: 'friend-requests', path: '/friend-requests', component: FollowRequests },
|
||||||
{ name: 'user-settings', path: '/user-settings', component: UserSettings }
|
{ name: 'user-settings', path: '/user-settings', component: UserSettings }
|
||||||
]
|
]
|
||||||
|
|
|
@ -159,6 +159,7 @@ const updateProfile = ({credentials, params}) => {
|
||||||
// bio
|
// bio
|
||||||
// homepage
|
// homepage
|
||||||
// location
|
// location
|
||||||
|
// token
|
||||||
const register = (params) => {
|
const register = (params) => {
|
||||||
const form = new FormData()
|
const form = new FormData()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue