-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
116 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import 'cypress-axe'; | ||
export declare const logout: () => void; | ||
export declare const login: (userName: string) => void; | ||
export declare function logout(): void; | ||
export declare function login(userName: string): void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import 'cypress-axe'; | ||
export const logout = () => { | ||
export function logout() { | ||
cy.visit('/logout'); | ||
}; | ||
export const login = (userName) => { | ||
} | ||
export function login(userName) { | ||
cy.visit('/login'); | ||
cy.get('.message').contains('Testing', { matchCase: false }); | ||
cy.get("form [name='userName']").type(userName); | ||
cy.get("form [name='password']").type(userName); | ||
cy.get('form').submit(); | ||
cy.location('pathname').should('not.contain', '/login'); | ||
cy.get('.navbar').should('have.length', 1); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export declare const randomString: () => string; | ||
export declare function randomString(): string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export const randomString = () => { | ||
export function randomString() { | ||
return Math.ceil(Math.random() * 100000).toString(); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export const randomString = (): string => { | ||
export function randomString(): string { | ||
return Math.ceil(Math.random() * 100_000).toString() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,46 @@ | ||
import * as userFunctions from '../helpers/functions.user.js'; | ||
const dashboardRedirectUrl = '/dashboard'; | ||
export const adminGetHandler = (request, response, next) => { | ||
if (userFunctions.userIsAdmin(request)) { | ||
return next(); | ||
next(); | ||
return; | ||
} | ||
return response.redirect('/dashboard'); | ||
response.redirect(dashboardRedirectUrl); | ||
}; | ||
export const adminPostHandler = (request, response, next) => { | ||
if (userFunctions.userIsAdmin(request)) { | ||
return next(); | ||
next(); | ||
return; | ||
} | ||
return response.json(userFunctions.forbiddenJSON); | ||
response.json(userFunctions.forbiddenJSON); | ||
}; | ||
export const updateGetHandler = (request, response, next) => { | ||
if (userFunctions.userCanUpdate(request)) { | ||
return next(); | ||
next(); | ||
return; | ||
} | ||
return response.redirect('/dashboard'); | ||
response.redirect(dashboardRedirectUrl); | ||
}; | ||
export const updateOrOperatorGetHandler = (request, response, next) => { | ||
if (userFunctions.userCanUpdate(request) || | ||
userFunctions.userIsOperator(request)) { | ||
return next(); | ||
next(); | ||
return; | ||
} | ||
return response.redirect('/dashboard'); | ||
response.redirect(dashboardRedirectUrl); | ||
}; | ||
export const updatePostHandler = (request, response, next) => { | ||
if (userFunctions.userCanUpdate(request)) { | ||
return next(); | ||
next(); | ||
return; | ||
} | ||
return response.json(userFunctions.forbiddenJSON); | ||
response.json(userFunctions.forbiddenJSON); | ||
}; | ||
export const updateOrOperatorPostHandler = (request, response, next) => { | ||
if (userFunctions.userCanUpdate(request) || | ||
userFunctions.userIsOperator(request)) { | ||
return next(); | ||
next(); | ||
return; | ||
} | ||
return response.json(userFunctions.forbiddenJSON); | ||
response.json(userFunctions.forbiddenJSON); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.