From 327b6fb5dcbabf5de61e1ce0fa6c65329a8ec45b Mon Sep 17 00:00:00 2001 From: Syldexia Date: Sun, 13 May 2018 15:09:07 +0100 Subject: Added delete account section to user settings --- src/services/api/api.service.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/services/api/api.service.js') diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index f14bfd6d..fd401068 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -30,6 +30,7 @@ const BLOCKING_URL = '/api/blocks/create.json' const UNBLOCKING_URL = '/api/blocks/destroy.json' const USER_URL = '/api/users/show.json' const FOLLOW_IMPORT_URL = '/api/pleroma/follow_import' +const DELETE_ACCOUNT_URL = '/api/pleroma/delete_account' import { each, map } from 'lodash' import 'whatwg-fetch' @@ -373,6 +374,19 @@ const followImport = ({params, credentials}) => { .then((response) => response.ok) } +const deleteAccount = ({credentials, password}) => { + const form = new FormData() + + form.append('password', password) + + return fetch(DELETE_ACCOUNT_URL, { + body: form, + method: 'POST', + headers: authHeaders(credentials) + }) + .then((response) => response.json()) +} + const fetchMutes = ({credentials}) => { const url = '/api/qvitter/mutes.json' @@ -408,7 +422,8 @@ const apiService = { updateProfile, updateBanner, externalProfile, - followImport + followImport, + deleteAccount } export default apiService -- cgit v1.2.3-70-g09d2 From e0ba6a587671c4e7d484152f35076c0fb1eb2996 Mon Sep 17 00:00:00 2001 From: Syldexia Date: Mon, 21 May 2018 23:01:09 +0100 Subject: Added change password to user settings --- src/components/user_settings/user_settings.js | 22 +++++++++++++++++++++- src/components/user_settings/user_settings.vue | 21 ++++++++++++++++++++- src/i18n/messages.js | 10 ++++++++-- src/services/api/api.service.js | 19 ++++++++++++++++++- .../backend_interactor_service.js | 4 +++- 5 files changed, 70 insertions(+), 6 deletions(-) (limited to 'src/services/api/api.service.js') diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index 1e7b9b12..b6026e18 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -13,7 +13,10 @@ const UserSettings = { previews: [ null, null, null ], deletingAccount: false, deleteAccountConfirmPasswordInput: '', - deleteAccountError: false + deleteAccountError: false, + changePasswordInputs: [ '', '', '' ], + changedPassword: false, + changePasswordError: false } }, components: { @@ -195,6 +198,23 @@ const UserSettings = { this.deleteAccountError = res.error } }) + }, + changePassword () { + const params = { + password: this.changePasswordInputs[0], + newPassword: this.changePasswordInputs[1], + newPasswordConfirmation: this.changePasswordInputs[2] + } + this.$store.state.api.backendInteractor.changePassword(params) + .then((res) => { + if (res.status === 'success') { + this.changedPassword = true + this.changePasswordError = false + } else { + this.changedPassword = false + this.changePasswordError = res.error + } + }) } } } diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue index ea9763f3..fbf3f651 100644 --- a/src/components/user_settings/user_settings.vue +++ b/src/components/user_settings/user_settings.vue @@ -49,6 +49,25 @@ +
+

{{$t('settings.change_password')}}

+
+

{{$t('settings.current_password')}}

+ +
+
+

{{$t('settings.new_password')}}

+ +
+
+

{{$t('settings.confirm_new_password')}}

+ +
+ +

{{$t('settings.changed_password')}}

+

{{$t('settings.change_password_error')}}

+

{{changePasswordError}}

+

{{$t('settings.follow_import')}}

{{$t('settings.import_followers_from_a_csv_file')}}

@@ -62,7 +81,7 @@

{{$t('settings.follows_imported')}}

- +

{{$t('settings.follow_import_error')}}

diff --git a/src/i18n/messages.js b/src/i18n/messages.js index 19b50272..54a99b5a 100644 --- a/src/i18n/messages.js +++ b/src/i18n/messages.js @@ -291,12 +291,18 @@ const en = { follows_imported: 'Follows imported! Processing them will take a while.', follow_import_error: 'Error importing followers', delete_account: 'Delete Account', - delete_account_description: 'Permanantly delete your account and all your messages.', + delete_account_description: 'Permanently delete your account and all your messages.', delete_account_instructions: 'Type your password in the input below to confirm account deletion.', delete_account_error: 'There was an issue deleting your account. If this persists please contact your instance administrator.', follow_export: 'Follow export', follow_export_processing: 'Processing, you\'ll soon be asked to download your file', - follow_export_button: 'Export your follows to a csv file' + follow_export_button: 'Export your follows to a csv file', + change_password: 'Change Password', + current_password: 'Current password', + 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.' }, notifications: { notifications: 'Notifications', diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index fd401068..65761aee 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -31,6 +31,7 @@ const UNBLOCKING_URL = '/api/blocks/destroy.json' const USER_URL = '/api/users/show.json' const FOLLOW_IMPORT_URL = '/api/pleroma/follow_import' const DELETE_ACCOUNT_URL = '/api/pleroma/delete_account' +const CHANGE_PASSWORD_URL = '/api/pleroma/change_password' import { each, map } from 'lodash' import 'whatwg-fetch' @@ -387,6 +388,21 @@ const deleteAccount = ({credentials, password}) => { .then((response) => response.json()) } +const changePassword = ({credentials, password, newPassword, newPasswordConfirmation}) => { + const form = new FormData() + + form.append('password', password) + form.append('new_password', newPassword) + form.append('new_password_confirmation', newPasswordConfirmation) + + return fetch(CHANGE_PASSWORD_URL, { + body: form, + method: 'POST', + headers: authHeaders(credentials) + }) + .then((response) => response.json()) +} + const fetchMutes = ({credentials}) => { const url = '/api/qvitter/mutes.json' @@ -423,7 +439,8 @@ const apiService = { updateBanner, externalProfile, followImport, - deleteAccount + deleteAccount, + changePassword } export default apiService diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index c5807bed..14173558 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -62,6 +62,7 @@ const backendInteractorService = (credentials) => { const followImport = ({params}) => apiService.followImport({params, credentials}) const deleteAccount = ({password}) => apiService.deleteAccount({credentials, password}) + const changePassword = ({password, newPassword, newPasswordConfirmation}) => apiService.changePassword({credentials, password, newPassword, newPasswordConfirmation}) const backendInteractorServiceInstance = { fetchStatus, @@ -85,7 +86,8 @@ const backendInteractorService = (credentials) => { updateProfile, externalProfile, followImport, - deleteAccount + deleteAccount, + changePassword } return backendInteractorServiceInstance -- cgit v1.2.3-70-g09d2 From 92a8ca00111b3cd0a5129964c47566a04ab54285 Mon Sep 17 00:00:00 2001 From: Astra Date: Thu, 7 Jun 2018 05:03:50 -0400 Subject: crt's compose box changes --- .../post_status_form/post_status_form.js | 17 ++++++++++++++++ .../post_status_form/post_status_form.vue | 23 ++++++++++++++++++++-- src/services/api/api.service.js | 4 +++- .../status_poster/status_poster.service.js | 4 ++-- 4 files changed, 43 insertions(+), 5 deletions(-) (limited to 'src/services/api/api.service.js') diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index e6742580..cdacfa14 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -46,6 +46,12 @@ const PostStatusForm = { error: null, posting: false, highlighted: 0, + vis: { + public: { 'icon-globe': true, big: true, selected: true }, + unlisted: { 'icon-lock-open-alt': true, big: true, selected: false }, + private: { 'icon-lock': true, big: true, selected: false }, + direct: { 'icon-mail-alt': true, big: true, selected: false } + }, newStatus: { status: statusText, files: [] @@ -170,6 +176,7 @@ const PostStatusForm = { this.caret = selectionStart }, postStatus (newStatus) { + console.log(newStatus); if (this.posting) { return } if (this.submitDisabled) { return } @@ -185,6 +192,8 @@ const PostStatusForm = { this.posting = true statusPoster.postStatus({ status: newStatus.status, + spoilerText: newStatus.spoilerText || undefined, + visibility: newStatus.visibility, media: newStatus.files, store: this.$store, inReplyToStatusId: this.replyTo @@ -198,6 +207,9 @@ const PostStatusForm = { let el = this.$el.querySelector('textarea') el.style.height = '16px' this.error = null + + Object.keys(this.vis).forEach(x => this.vis[x].selected = false) + this.vis.public.selected = true } else { this.error = data.error } @@ -249,6 +261,11 @@ const PostStatusForm = { }, clearError () { this.error = null + }, + changeVis (visibility) { + console.log(visibility) + Object.keys(this.vis).forEach(x => this.vis[x].selected = x == visibility) + this.newStatus.visibility = visibility } } } diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 28dd227e..e76850ae 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -2,6 +2,11 @@
+ +
+ + + + +
@@ -143,7 +154,15 @@ line-height:24px; } - form textarea { + form textarea.form-cw { + line-height:16px; + resize: none; + overflow: hidden; + transition: min-height 200ms 100ms; + min-height: 1px; + } + + form textarea.form-control { line-height:16px; resize: none; overflow: hidden; @@ -152,7 +171,7 @@ box-sizing: content-box; } - form textarea:focus { + form textarea.form-control:focus { min-height: 48px; } diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 65761aee..0d91851b 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -331,12 +331,14 @@ const retweet = ({ id, credentials }) => { }) } -const postStatus = ({credentials, status, mediaIds, inReplyToStatusId}) => { +const postStatus = ({credentials, status, spoilerText, visibility, mediaIds, inReplyToStatusId}) => { const idsText = mediaIds.join(',') const form = new FormData() form.append('status', status) form.append('source', 'Pleroma FE') + if (spoilerText) form.append('spoiler_text', spoilerText) + if (visibility) form.append('visibility', visibility) form.append('media_ids', idsText) if (inReplyToStatusId) { form.append('in_reply_to_status_id', inReplyToStatusId) diff --git a/src/services/status_poster/status_poster.service.js b/src/services/status_poster/status_poster.service.js index 001ff8a5..3381e9e2 100644 --- a/src/services/status_poster/status_poster.service.js +++ b/src/services/status_poster/status_poster.service.js @@ -1,10 +1,10 @@ import { map } from 'lodash' import apiService from '../api/api.service.js' -const postStatus = ({ store, status, media = [], inReplyToStatusId = undefined }) => { +const postStatus = ({ store, status, spoilerText, visibility, media = [], inReplyToStatusId = undefined }) => { const mediaIds = map(media, 'id') - return apiService.postStatus({credentials: store.state.users.currentUser.credentials, status, mediaIds, inReplyToStatusId}) + return apiService.postStatus({credentials: store.state.users.currentUser.credentials, status, spoilerText, visibility, mediaIds, inReplyToStatusId}) .then((data) => data.json()) .then((data) => { if (!data.error) { -- cgit v1.2.3-70-g09d2