diff --git a/seaside/src/App.vue b/seaside/src/App.vue
index 14490511..5d17596c 100644
--- a/seaside/src/App.vue
+++ b/seaside/src/App.vue
@@ -12,6 +12,7 @@
+
\ No newline at end of file
diff --git a/seaside/src/security/components/CreateAccountComponent.vue b/seaside/src/security/components/CreateAccountComponent.vue
new file mode 100644
index 00000000..e4236ab2
--- /dev/null
+++ b/seaside/src/security/components/CreateAccountComponent.vue
@@ -0,0 +1,59 @@
+
+
+ Create new account
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/seaside/src/store/sidenav/SidenavMutation.enum.ts b/seaside/src/store/sidenav/SidenavMutation.enum.ts
index 8b60d9fb..3d2c4571 100644
--- a/seaside/src/store/sidenav/SidenavMutation.enum.ts
+++ b/seaside/src/store/sidenav/SidenavMutation.enum.ts
@@ -1,3 +1,4 @@
export enum SidenavMutation {
TOGGLE = 'sidenav/toggleSidenav',
+ OPEN_CREATE_ACCOUNT_MUTATION = 'user/openCreateAccount',
}
\ No newline at end of file
diff --git a/seaside/src/store/user/UserConstants.ts b/seaside/src/store/user/UserConstants.ts
index ee6eab6d..af360fdb 100644
--- a/seaside/src/store/user/UserConstants.ts
+++ b/seaside/src/store/user/UserConstants.ts
@@ -1,12 +1,16 @@
export const NAMESPACE = 'user';
export const LOGOUT = 'logout';
export const UPDATE = 'update';
+export const OPEN_CREATE_ACCOUNT = 'openCreateAccount';
+export const CLOSE_CREATE_ACCOUNT = 'closeCreateAccount';
export const ADD_ROLE = 'addRole';
export const HAS_ROLE_USER = 'hasRoleUser';
export const HAS_ROLE_MANAGER = 'hasRoleManager';
export const HAS_ROLE_ADMIN = 'hasRoleAdmin';
export const LOGOUT_MUTATION = `${NAMESPACE}/${LOGOUT}`;
export const UPDATE_MUTATION = `${NAMESPACE}/${UPDATE}`;
+export const OPEN_CREATE_ACCOUNT_MUTATION = `${NAMESPACE}/${OPEN_CREATE_ACCOUNT}`;
+export const CLOSE_CREATE_ACCOUNT_MUTATION = `${NAMESPACE}/${CLOSE_CREATE_ACCOUNT}`;
export const USER_ADD_ROLE_MUTATION = `${NAMESPACE}/${ADD_ROLE}`;
export const HAS_ROLE_USER_GETTER = `${NAMESPACE}/${HAS_ROLE_USER}`;
export const HAS_ROLE_MANAGER_GETTER = `${NAMESPACE}/${HAS_ROLE_MANAGER}`;
diff --git a/seaside/src/store/user/user.ts b/seaside/src/store/user/user.ts
index 60a8d449..50539845 100644
--- a/seaside/src/store/user/user.ts
+++ b/seaside/src/store/user/user.ts
@@ -1,16 +1,27 @@
-import {ANONYMOUS, User} from "@/security/model/User";
-import {UserRole} from "@/security/model/UserRole.enum";
-import {ADD_ROLE, HAS_ROLE_ADMIN, HAS_ROLE_MANAGER, HAS_ROLE_USER, LOGOUT, UPDATE} from "@/store/user/UserConstants";
-import {GetterTree} from "vuex";
+import { ANONYMOUS, User } from '@/security/model/User';
+import { UserRole } from '@/security/model/UserRole.enum';
+import {
+ ADD_ROLE,
+ CLOSE_CREATE_ACCOUNT,
+ HAS_ROLE_ADMIN,
+ HAS_ROLE_MANAGER,
+ HAS_ROLE_USER,
+ LOGOUT,
+ OPEN_CREATE_ACCOUNT,
+ UPDATE,
+} from '@/store/user/UserConstants';
+import { GetterTree } from 'vuex';
export type UserState = {
user: User;
isAuthenticated: boolean | undefined;
+ isCreateAccountOpen: boolean;
}
const state = (): UserState => ({
user: ANONYMOUS,
isAuthenticated: undefined,
+ isCreateAccountOpen: false,
});
// getters
@@ -24,32 +35,38 @@ const getters: GetterTree = {
[HAS_ROLE_ADMIN](st: UserState): boolean {
return hasRole(st.user, UserRole.ADMIN);
},
-}
+};
// actions
-const actions = {}
+const actions = {};
// mutations
const mutations = {
+ [ADD_ROLE](st: UserState, payload: string): void {
+ st.user.roles.push(payload);
+ },
+ [CLOSE_CREATE_ACCOUNT](st: UserState): void {
+ st.isCreateAccountOpen = false;
+ },
[LOGOUT](st: UserState): void {
st.user = ANONYMOUS;
st.isAuthenticated = false;
},
+ [OPEN_CREATE_ACCOUNT](st: UserState): void {
+ st.isCreateAccountOpen = true;
+ },
[UPDATE](st: UserState, payload: User): void {
st.user = payload;
st.isAuthenticated = hasRole(st.user, UserRole.USER);
},
- [ADD_ROLE](st: UserState, payload: string): void {
- st.user.roles.push(payload);
- },
-}
+};
const hasRole = (user: User, expectedRole: UserRole, entity?: string): boolean => {
if (!expectedRole) {
throw new Error();
}
if (!user && user === null) {
- return false
+ return false;
}
let hasRole = false;
let userRoles: string[] = (entity)
@@ -66,12 +83,12 @@ const hasRole = (user: User, expectedRole: UserRole, entity?: string): boolean =
}
}
return false;
-}
+};
export default {
namespaced: true,
state,
getters,
actions,
- mutations
-}
\ No newline at end of file
+ mutations,
+};
\ No newline at end of file