Skip to content

Commit

Permalink
Merged in bugfix/SHIBUI-1179 (pull request #278)
Browse files Browse the repository at this point in the history
SHIBUI-1179 Updated to use error.html and fix pathing to css/fonts.

Approved-by: Jonathan Johnson <jj@scaldingspoon.com>
  • Loading branch information
rmathis committed Jan 24, 2019
2 parents c4043ea + 983780d commit 01ac06a
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
user = persistedUser.get();
}
if (user.getRole().equals(ROLE_NONE)) {
((HttpServletResponse) response).sendRedirect("/static.html");
((HttpServletResponse) response).sendRedirect("/unsecured/error.html");
} else {
chain.doFilter(request, response); // else, user is in the system already, carry on
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ protected void configure(HttpSecurity http) throws Exception {

@Configuration
@Order(1)
public static class StaticSecurityConfiguration extends WebSecurityConfigurerAdapter {
public static class UnsecuredSecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.antMatcher("/static.html").authorizeRequests().antMatchers("/static.html").permitAll();
http.antMatcher("/unsecured/**/*").authorizeRequests().antMatchers("/unsecured/**/*").permitAll();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class AddNewUserFilterTests extends Specification {
1 * roleRepository.save(_)
1 * userRepository.save(_)
1 * emailService.sendNewUserMail('newUser')
1 * response.sendRedirect("/static.html")
1 * response.sendRedirect("/unsecured/error.html")
}

def "existing users are not redirected"() {
Expand Down
20 changes: 20 additions & 0 deletions ui/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const fs = require('fs-extra');

fs.ensureDir('./dist/unsecured').then(function () {
try {
fs.copySync('./src/error.html', './dist/unsecured/error.html')
console.log('copy error page success!')
} catch (err) {
console.error(err)
}

try {
fs.copySync('./node_modules/font-awesome/fonts', './dist/unsecured');
console.log('copy fonts success!')
} catch (err) {
console.log(err);
}
});



26 changes: 26 additions & 0 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"test": "ng test --code-coverage",
"lint": "ng lint",
"e2e": "ng e2e",
"build:static": "node-sass src/static.scss ./dist/static.css",
"copy:static": "ncp ./src/static.html ./dist/static.html",
"copy": "npm run build:static && npm run copy:static",
"build:static": "node-sass src/static.scss ./dist/unsecured/static.css",
"copy:static": "node ./build",
"copy": "npm run copy:static && npm run build:static",
"buildProd": "ng build --prod && npm run copy",
"bundle-report": "webpack-bundle-analyzer dist/stats.json"
},
Expand Down Expand Up @@ -55,6 +55,7 @@
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "~4.2.1",
"fs-extra": "^7.0.1",
"jasmine-core": "~2.99.0",
"jasmine-marbles": "^0.3.1",
"jasmine-spec-reporter": "~4.1.0",
Expand Down
File renamed without changes.

0 comments on commit 01ac06a

Please sign in to comment.