Refactor login components and adjust login API routes (#1678)

* Refactor login components and adjust API routes

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

* Adjust API /me response and redux state

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

* Fix moved function

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

* Update cypress tests

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

* Adjust mock response

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

* Integrate new common fields and hook into profile page

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

* Remove openid

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

* Fix config mock

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>

Co-authored-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Erik Michelson 2021-12-11 01:32:38 +01:00 committed by GitHub
parent fe640268c5
commit eab189c3c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 911 additions and 507 deletions

View file

@ -22,8 +22,7 @@ export const initialState: Config = {
google: false,
saml: false,
oauth2: false,
internal: false,
openid: false
local: false
},
branding: {
name: '',

View file

@ -6,8 +6,8 @@
import { DateTime } from 'luxon'
import type { NoteDetails } from './types/note-details'
import type { SlideOptions } from './types/slide-show-options'
import { NoteTextDirection, NoteType } from './types/note-details'
import type { SlideOptions } from './types/slide-show-options'
export const initialSlideOptions: SlideOptions = {
transition: 'zoom',
@ -30,7 +30,7 @@ export const initialState: NoteDetails = {
createTime: DateTime.fromSeconds(0),
lastChange: {
timestamp: DateTime.fromSeconds(0),
userName: ''
username: ''
},
alias: '',
viewCount: 0,

View file

@ -182,7 +182,7 @@ const convertNoteDtoToNoteDetails = (note: NoteDto): NoteDetails => {
noteTitle: initialState.noteTitle,
createTime: DateTime.fromISO(note.metadata.createTime),
lastChange: {
userName: note.metadata.updateUser.userName,
username: note.metadata.updateUser.username,
timestamp: DateTime.fromISO(note.metadata.updateTime)
},
firstHeading: initialState.firstHeading,

View file

@ -19,7 +19,7 @@ export interface NoteDetails {
id: string
createTime: DateTime
lastChange: {
userName: string
username: string
timestamp: DateTime
}
viewCount: number

View file

@ -23,8 +23,9 @@ export interface ClearUserAction extends Action<UserActionType> {
}
export interface UserState {
id: string
name: string
username: string
displayName: string
email: string
photo: string
provider: LoginProvider
}
@ -38,9 +39,8 @@ export enum LoginProvider {
GOOGLE = 'google',
SAML = 'saml',
OAUTH2 = 'oauth2',
INTERNAL = 'internal',
LDAP = 'ldap',
OPENID = 'openid'
LOCAL = 'local',
LDAP = 'ldap'
}
export type OptionalUserState = UserState | null