Added ability to set password for groups
• Added: - ability to set password for groups - GroupPasswordModal - checks for if has password - rate limiting in rack_attack
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
GROUP_EDITOR_RESET,
|
||||
GROUP_EDITOR_SETUP,
|
||||
GROUP_EDITOR_TITLE_CHANGE,
|
||||
GROUP_EDITOR_PASSWORD_CHANGE,
|
||||
GROUP_EDITOR_DESCRIPTION_CHANGE,
|
||||
GROUP_EDITOR_COVER_IMAGE_CHANGE,
|
||||
GROUP_EDITOR_ID_CHANGE,
|
||||
@@ -24,6 +25,7 @@ const initialState = ImmutableMap({
|
||||
isSubmitting: false,
|
||||
isChanged: false,
|
||||
title: '',
|
||||
password: '',
|
||||
description: '',
|
||||
id: '',
|
||||
tags: '',
|
||||
@@ -48,6 +50,7 @@ export default function groupEditorReducer(state = initialState, action) {
|
||||
return state.withMutations((map) => {
|
||||
map.set('groupId', action.group.get('id'))
|
||||
map.set('title', action.group.get('title'))
|
||||
map.set('password', action.group.get('password'))
|
||||
map.set('description', action.group.get('description'))
|
||||
map.set('tags', tags)
|
||||
map.set('isPrivate', action.group.get('is_private'))
|
||||
@@ -66,6 +69,11 @@ export default function groupEditorReducer(state = initialState, action) {
|
||||
map.set('description', action.description)
|
||||
map.set('isChanged', true)
|
||||
})
|
||||
case GROUP_EDITOR_PASSWORD_CHANGE:
|
||||
return state.withMutations((map) => {
|
||||
map.set('password', action.password)
|
||||
map.set('isChanged', true)
|
||||
})
|
||||
case GROUP_EDITOR_COVER_IMAGE_CHANGE:
|
||||
return state.withMutations((map) => {
|
||||
map.set('coverImage', action.value)
|
||||
|
||||
@@ -6,6 +6,10 @@ import {
|
||||
GROUP_SORT,
|
||||
GROUP_TIMELINE_SORT,
|
||||
GROUP_TIMELINE_TOP_SORT,
|
||||
GROUP_CHECK_PASSWORD_RESET,
|
||||
GROUP_CHECK_PASSWORD_REQUEST,
|
||||
GROUP_CHECK_PASSWORD_SUCCESS,
|
||||
GROUP_CHECK_PASSWORD_FAIL,
|
||||
} from '../actions/groups'
|
||||
import {
|
||||
GROUP_TIMELINE_SORTING_TYPE_TOP,
|
||||
@@ -18,6 +22,7 @@ const tabs = ['new', 'featured', 'member', 'admin']
|
||||
const initialState = ImmutableMap({
|
||||
sortByValue: GROUP_TIMELINE_SORTING_TYPE_NEWEST,
|
||||
sortByTopValue: '',
|
||||
passwordCheck: ImmutableMap(),
|
||||
new: ImmutableMap({
|
||||
isFetched: false,
|
||||
isLoading: false,
|
||||
@@ -80,6 +85,32 @@ export default function groupLists(state = initialState, action) {
|
||||
mutable.set('sortByValue', GROUP_TIMELINE_SORTING_TYPE_TOP)
|
||||
mutable.set('sortByTopValue', action.sortValue)
|
||||
})
|
||||
|
||||
case GROUP_CHECK_PASSWORD_RESET:
|
||||
return state.withMutations((mutable) => {
|
||||
mutable.setIn(['passwordCheck', 'isError'], false)
|
||||
mutable.setIn(['passwordCheck', 'isSuccess'], false)
|
||||
mutable.setIn(['passwordCheck', 'isLoading'], false)
|
||||
})
|
||||
case GROUP_CHECK_PASSWORD_REQUEST:
|
||||
return state.withMutations((mutable) => {
|
||||
mutable.setIn(['passwordCheck', 'isError'], false)
|
||||
mutable.setIn(['passwordCheck', 'isSuccess'], false)
|
||||
mutable.setIn(['passwordCheck', 'isLoading'], true)
|
||||
})
|
||||
case GROUP_CHECK_PASSWORD_SUCCESS:
|
||||
return state.withMutations((mutable) => {
|
||||
mutable.setIn(['passwordCheck', 'isError'], false)
|
||||
mutable.setIn(['passwordCheck', 'isSuccess'], true)
|
||||
mutable.setIn(['passwordCheck', 'isLoading'], false)
|
||||
})
|
||||
case GROUP_CHECK_PASSWORD_FAIL:
|
||||
return state.withMutations((mutable) => {
|
||||
mutable.setIn(['passwordCheck', 'isError'], true)
|
||||
mutable.setIn(['passwordCheck', 'isSuccess'], false)
|
||||
mutable.setIn(['passwordCheck', 'isLoading'], false)
|
||||
})
|
||||
|
||||
default:
|
||||
return state
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user