forked from srxl/akkoma-fe
user settings: enable locking/unlocking an account
This commit is contained in:
parent
648f31f44c
commit
7a08ba43e2
4 changed files with 13 additions and 4 deletions
|
@ -5,6 +5,7 @@ const UserSettings = {
|
||||||
return {
|
return {
|
||||||
newname: this.$store.state.users.currentUser.name,
|
newname: this.$store.state.users.currentUser.name,
|
||||||
newbio: this.$store.state.users.currentUser.description,
|
newbio: this.$store.state.users.currentUser.description,
|
||||||
|
newlocked: this.$store.state.users.currentUser.locked,
|
||||||
followList: null,
|
followList: null,
|
||||||
followImportError: false,
|
followImportError: false,
|
||||||
followsImported: false,
|
followsImported: false,
|
||||||
|
@ -34,7 +35,8 @@ const UserSettings = {
|
||||||
updateProfile () {
|
updateProfile () {
|
||||||
const name = this.newname
|
const name = this.newname
|
||||||
const description = this.newbio
|
const description = this.newbio
|
||||||
this.$store.state.api.backendInteractor.updateProfile({params: {name, description}}).then((user) => {
|
const locked = this.newlocked
|
||||||
|
this.$store.state.api.backendInteractor.updateProfile({params: {name, description, locked}}).then((user) => {
|
||||||
if (!user.error) {
|
if (!user.error) {
|
||||||
this.$store.commit('addNewUsers', [user])
|
this.$store.commit('addNewUsers', [user])
|
||||||
this.$store.commit('setCurrentUser', user)
|
this.$store.commit('setCurrentUser', user)
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
<input class='name-changer' id='username' v-model="newname"></input>
|
<input class='name-changer' id='username' v-model="newname"></input>
|
||||||
<p>{{$t('settings.bio')}}</p>
|
<p>{{$t('settings.bio')}}</p>
|
||||||
<textarea class="bio" v-model="newbio"></textarea>
|
<textarea class="bio" v-model="newbio"></textarea>
|
||||||
|
<div class="setting-item">
|
||||||
|
<input type="checkbox" v-model="newlocked" id="account-locked">
|
||||||
|
<label for="account-locked">{{$t('settings.lock_account_description')}}</label>
|
||||||
|
</div>
|
||||||
<button :disabled='newname.length <= 0' class="btn btn-default" @click="updateProfile">{{$t('general.submit')}}</button>
|
<button :disabled='newname.length <= 0' class="btn btn-default" @click="updateProfile">{{$t('general.submit')}}</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-item">
|
<div class="setting-item">
|
||||||
|
|
|
@ -302,7 +302,8 @@ const en = {
|
||||||
new_password: 'New password',
|
new_password: 'New password',
|
||||||
confirm_new_password: 'Confirm new password',
|
confirm_new_password: 'Confirm new password',
|
||||||
changed_password: 'Password changed successfully!',
|
changed_password: 'Password changed successfully!',
|
||||||
change_password_error: 'There was an issue changing your password.'
|
change_password_error: 'There was an issue changing your password.',
|
||||||
|
lock_account_description: 'Restrict your account to approved followers only'
|
||||||
},
|
},
|
||||||
notifications: {
|
notifications: {
|
||||||
notifications: 'Notifications',
|
notifications: 'Notifications',
|
||||||
|
|
|
@ -127,11 +127,13 @@ const updateBanner = ({credentials, params}) => {
|
||||||
const updateProfile = ({credentials, params}) => {
|
const updateProfile = ({credentials, params}) => {
|
||||||
let url = PROFILE_UPDATE_URL
|
let url = PROFILE_UPDATE_URL
|
||||||
|
|
||||||
|
console.log(params)
|
||||||
|
|
||||||
const form = new FormData()
|
const form = new FormData()
|
||||||
|
|
||||||
each(params, (value, key) => {
|
each(params, (value, key) => {
|
||||||
if (key === 'description' || /* Always include description, because it might be empty */
|
/* Always include description and locked, because it might be empty or false */
|
||||||
value) {
|
if (key === 'description' || key === 'locked' || value) {
|
||||||
form.append(key, value)
|
form.append(key, value)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue