Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login redirect doesn't work in OAuth2 and Vue #13046

Merged
merged 3 commits into from
Nov 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export default class LoginService {
if (contextPath.endsWith('accessdenied')) {
contextPath = contextPath.substring(0, contextPath.indexOf('accessdenied'));
}
if (contextPath.endsWith('forbidden')) {
contextPath = contextPath.substring(0, contextPath.indexOf('forbidden'));
}
if (!contextPath.endsWith('/')) {
contextPath = contextPath + '/';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
data-cy="entity">
<span slot="button-content" class="navbar-dropdown-menu">
<font-awesome-icon icon="th-list" />
<span v-text="$t('global.menu.entities.main')">Entities</span>
<span class="no-bold" v-text="$t('global.menu.entities.main')">Entities</span>
</span>
<!-- jhipster-needle-add-entity-to-menu - JHipster will add entities to the menu here -->
</b-nav-item-dropdown>
Expand All @@ -45,7 +45,7 @@
data-cy="adminMenu">
<span slot="button-content" class="navbar-dropdown-menu">
<font-awesome-icon icon="users-cog" />
<span v-text="$t('global.menu.admin.main')">Administration</span>
<span class="no-bold" v-text="$t('global.menu.admin.main')">Administration</span>
</span>
<%_ if (applicationType === 'gateway' && serviceDiscoveryType) { _%>
<b-dropdown-item to="/admin/gateway" active-class="active">
Expand Down Expand Up @@ -98,7 +98,7 @@
<b-nav-item-dropdown id="languagesnavBarDropdown" right v-if="languages && Object.keys(languages).length > 1">
<span slot="button-content">
<font-awesome-icon icon="flag" />
<span v-text="$t('global.menu.language')">Language</span>
<span class="no-bold" v-text="$t('global.menu.language')">Language</span>
</span>
<b-dropdown-item v-for="(value, key) in languages" :key="`lang-${key}`" v-on:click="changeLanguage(key);"
:class="{ active: isActiveLanguage(key)}">
Expand All @@ -116,7 +116,7 @@
data-cy="accountMenu">
<span slot="button-content" class="navbar-dropdown-menu">
<font-awesome-icon icon="user" />
<span v-text="$t('global.menu.account.main')">
<span class="no-bold" v-text="$t('global.menu.account.main')">
Account
</span>
</span>
Expand Down Expand Up @@ -202,7 +202,7 @@
margin-left: 1.5rem;
}

.jh-navbar a.nav-link {
.jh-navbar a.nav-link, .jh-navbar .no-bold {
font-weight: 400;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@ describe('Login Service test suite', () => {
expect(loc.href).toBe('//localhost/oauth2/authorization/oidc');
});

it('should build url for login with loc.pathname equals to /accessdenied', () => {
const loc = { href: '', hostname: 'localhost', pathname: '/accessdenied' };

loginService.login(loc);

expect(loc.href).toBe('//localhost/oauth2/authorization/oidc');
});

it('should build url for login with loc.pathname equals to /forbidden', () => {
const loc = { href: '', hostname: 'localhost', pathname: '/forbidden' };

loginService.login(loc);

expect(loc.href).toBe('//localhost/oauth2/authorization/oidc');
});

it('should build url for login behind client proxy', () => {
const loc = {href: '', port: '<%= serverPort %>', hostname: 'localhost', pathname: '/'};

Expand Down