diff --git a/src/api/users.js b/src/api/users.js
index 8298eeca..642dd1a7 100644
--- a/src/api/users.js
+++ b/src/api/users.js
@@ -71,6 +71,25 @@ export async function fetchUser(id, authHost, token) {
})
}
+export async function fetchUserCredentials(nickname, authHost, token) {
+ return await request({
+ baseURL: baseName(authHost),
+ url: `/api/pleroma/admin/users/${nickname}/credentials`,
+ method: 'get',
+ headers: authHeaders(token)
+ })
+}
+
+export async function updateUserCredentials(nickname, credentials, authHost, token) {
+ return await request({
+ baseURL: baseName(authHost),
+ url: `/api/pleroma/admin/users/${nickname}/credentials`,
+ method: 'patch',
+ headers: authHeaders(token),
+ data: credentials
+ })
+}
+
export async function fetchUsers(filters, authHost, token, page = 1) {
return await request({
baseURL: baseName(authHost),
diff --git a/src/lang/en.js b/src/lang/en.js
index 8b8e9ff7..5e98a3cb 100644
--- a/src/lang/en.js
+++ b/src/lang/en.js
@@ -261,7 +261,22 @@ export default {
activeUppercase: 'Active',
active: 'active',
deactivated: 'deactivated',
- noStatuses: 'No statuses to show'
+ noStatuses: 'No statuses to show',
+ securitySettings: {
+ email: 'Email',
+ password: 'Password',
+ securitySettings: 'Security settings',
+ passwordChangeWarning1: 'Setting a new password will cause the user to be signed out from any client they have used before.',
+ passwordChangeWarning2: 'When the user signs in with this password, they will be asked to set a new one.',
+ passwordLengthNotice: 'Make sure it\'s at least {minLength} characters long.',
+ inputNewEmail: 'Input new email',
+ inputNewPassword: 'Input new password',
+ passwordUpdated: 'The password has been updated',
+ emailUpdated: 'The email has been updated',
+ success: 'Success',
+ submit: 'Submit',
+ close: 'Close'
+ }
},
usersFilter: {
inputPlaceholder: 'Select filter',
diff --git a/src/store/modules/userProfile.js b/src/store/modules/userProfile.js
index 5a7e4394..af54072c 100644
--- a/src/store/modules/userProfile.js
+++ b/src/store/modules/userProfile.js
@@ -1,10 +1,11 @@
-import { fetchUser, fetchUserStatuses } from '@/api/users'
+import { fetchUser, fetchUserStatuses, fetchUserCredentials, updateUserCredentials } from '@/api/users'
const userProfile = {
state: {
statuses: [],
statusesLoading: true,
user: {},
+ userCredentials: {},
userProfileLoading: true
},
mutations: {
@@ -19,6 +20,9 @@ const userProfile = {
},
SET_USER_PROFILE_LOADING: (state, status) => {
state.userProfileLoading = status
+ },
+ SET_USER_CREDENTIALS: (state, userCredentials) => {
+ state.userCredentials = userCredentials
}
},
actions: {
@@ -38,6 +42,14 @@ const userProfile = {
commit('SET_STATUSES', statuses.data)
commit('SET_STATUSES_LOADING', false)
+ },
+ async FetchUserCredentials({ commit, getters }, { nickname }) {
+ const userResponse = await fetchUserCredentials(nickname, getters.authHost, getters.token)
+ commit('SET_USER_CREDENTIALS', userResponse.data)
+ },
+ async UpdateUserCredentials({ dispatch, getters }, { nickname, credentials }) {
+ await updateUserCredentials(nickname, credentials, getters.authHost, getters.token)
+ dispatch('FetchUserCredentials', { nickname })
}
}
}
diff --git a/src/views/users/components/SecuritySettingsModal.vue b/src/views/users/components/SecuritySettingsModal.vue
new file mode 100644
index 00000000..58c757b1
--- /dev/null
+++ b/src/views/users/components/SecuritySettingsModal.vue
@@ -0,0 +1,155 @@
+
+
+
+
+
+ {{ $t('userProfile.securitySettings.passwordChangeWarning1') }} {{ $t('userProfile.securitySettings.passwordChangeWarning2') }}
+
+
+