user settings: enable locking/unlocking an account
This commit is contained in:
parent
648f31f44c
commit
7a08ba43e2
|
@ -5,6 +5,7 @@ const UserSettings = {
|
|||
return {
|
||||
newname: this.$store.state.users.currentUser.name,
|
||||
newbio: this.$store.state.users.currentUser.description,
|
||||
newlocked: this.$store.state.users.currentUser.locked,
|
||||
followList: null,
|
||||
followImportError: false,
|
||||
followsImported: false,
|
||||
|
@ -34,7 +35,8 @@ const UserSettings = {
|
|||
updateProfile () {
|
||||
const name = this.newname
|
||||
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) {
|
||||
this.$store.commit('addNewUsers', [user])
|
||||
this.$store.commit('setCurrentUser', user)
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
<input class='name-changer' id='username' v-model="newname"></input>
|
||||
<p>{{$t('settings.bio')}}</p>
|
||||
<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>
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
|
|
|
@ -302,7 +302,8 @@ const en = {
|
|||
new_password: 'New password',
|
||||
confirm_new_password: 'Confirm new password',
|
||||
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',
|
||||
|
|
|
@ -127,11 +127,13 @@ const updateBanner = ({credentials, params}) => {
|
|||
const updateProfile = ({credentials, params}) => {
|
||||
let url = PROFILE_UPDATE_URL
|
||||
|
||||
console.log(params)
|
||||
|
||||
const form = new FormData()
|
||||
|
||||
each(params, (value, key) => {
|
||||
if (key === 'description' || /* Always include description, because it might be empty */
|
||||
value) {
|
||||
/* Always include description and locked, because it might be empty or false */
|
||||
if (key === 'description' || key === 'locked' || value) {
|
||||
form.append(key, value)
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue