generator-jhipster 8.10.0 → 8.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli/cli.mjs +0 -13
- package/dist/cli/environment-builder.mjs +3 -1
- package/dist/generators/angular/resources/package.json +18 -18
- package/dist/generators/angular/templates/README.md.jhi.client.angular.ejs +1 -1
- package/dist/generators/angular/templates/eslint.config.js.jhi.angular.ejs +4 -6
- package/dist/generators/angular/templates/src/main/webapp/app/admin/user-management/list/user-management.component.html.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/core/tracker/tracker.service.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.html.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/update/_entityFile_-update.component.html.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/shared/sort/sort.service.ts.ejs +3 -3
- package/dist/generators/base/api.d.ts +3 -1
- package/dist/generators/base/shared-data.js +1 -0
- package/dist/generators/base/support/contents.d.ts +10 -1
- package/dist/generators/base/support/contents.js +9 -0
- package/dist/generators/base/support/index.d.ts +1 -0
- package/dist/generators/base/support/index.js +1 -0
- package/dist/generators/base/support/needles.js +2 -6
- package/dist/generators/base/support/os.d.ts +1 -0
- package/dist/generators/base/support/os.js +20 -0
- package/dist/generators/base/support/write-files.d.ts +18 -0
- package/dist/generators/base/support/write-files.js +0 -26
- package/dist/generators/base-core/generator.js +7 -4
- package/dist/generators/bootstrap/generator.js +31 -2
- package/dist/generators/bootstrap/support/auto-crlf-transform.js +2 -2
- package/dist/generators/bootstrap-application-base/generator.js +1 -3
- package/dist/generators/client/resources/package.json +4 -4
- package/dist/generators/common/resources/package.json +1 -1
- package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/account/logout.cy.ts.ejs +11 -3
- package/dist/generators/cypress/templates/src/test/javascript/cypress/support/oauth2.ts.ejs +4 -4
- package/dist/generators/generate-blueprint/resources/package.json +2 -2
- package/dist/generators/generator-constants.d.ts +1 -1
- package/dist/generators/generator-constants.js +1 -1
- package/dist/generators/gradle/templates/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/dist/generators/init/resources/.node-version +1 -1
- package/dist/generators/java/generators/graalvm/internal/constants.d.ts +1 -1
- package/dist/generators/java/generators/graalvm/internal/constants.js +1 -1
- package/dist/generators/java/generators/node/generator.js +2 -1
- package/dist/generators/javascript/generators/eslint/templates/eslint.config.js.jhi.ejs +8 -0
- package/dist/generators/javascript/resources/package.json +3 -3
- package/dist/generators/languages/support/languages.js +1 -0
- package/dist/generators/languages/templates/entity/i18n/entity_he.json.ejs +78 -0
- package/dist/generators/languages/templates/src/main/resources/i18n/messages_he.properties.ejs +41 -0
- package/dist/generators/languages/templates/src/main/webapp/i18n/he/activate.json.ejs +27 -0
- package/dist/generators/languages/templates/src/main/webapp/i18n/he/configuration.json +11 -0
- package/dist/generators/languages/templates/src/main/webapp/i18n/he/error.json +15 -0
- package/dist/generators/languages/templates/src/main/webapp/i18n/he/gateway.json +16 -0
- package/dist/generators/languages/templates/src/main/webapp/i18n/he/global.json.ejs +172 -0
- package/dist/generators/languages/templates/src/main/webapp/i18n/he/health.json.ejs +75 -0
- package/dist/generators/languages/templates/src/main/webapp/i18n/he/home.json.ejs +20 -0
- package/dist/generators/languages/templates/src/main/webapp/i18n/he/login.json +20 -0
- package/dist/generators/languages/templates/src/main/webapp/i18n/he/logs.json +12 -0
- package/dist/generators/languages/templates/src/main/webapp/i18n/he/metrics.json +103 -0
- package/dist/generators/languages/templates/src/main/webapp/i18n/he/password.json +13 -0
- package/dist/generators/languages/templates/src/main/webapp/i18n/he/register.json +25 -0
- package/dist/generators/languages/templates/src/main/webapp/i18n/he/reset.json.ejs +45 -0
- package/dist/generators/languages/templates/src/main/webapp/i18n/he/sessions.json +16 -0
- package/dist/generators/languages/templates/src/main/webapp/i18n/he/settings.json +33 -0
- package/dist/generators/languages/templates/src/main/webapp/i18n/he/tracker.json +13 -0
- package/dist/generators/languages/templates/src/main/webapp/i18n/he/user-management.json +32 -0
- package/dist/generators/languages/templates/src/test/resources/i18n/messages_he.properties.ejs +4 -0
- package/dist/generators/react/resources/package.json +23 -23
- package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-delete-dialog.tsx.ejs +2 -1
- package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.reducer.ts.ejs +4 -4
- package/dist/generators/react/templates/src/main/webapp/app/modules/administration/administration.reducer.spec.ts.ejs +0 -6
- package/dist/generators/react/templates/src/main/webapp/app/shared/reducers/application-profile.spec.ts.ejs +0 -6
- package/dist/generators/react/templates/src/main/webapp/app/shared/reducers/locale.spec.ts.ejs +0 -47
- package/dist/generators/react/templates/src/main/webapp/app/shared/reducers/reducer.utils.ts.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/shared/util/entity-utils.ts.ejs +1 -1
- package/dist/generators/server/resources/Dockerfile +11 -11
- package/dist/generators/server/resources/gradle/libs.versions.toml +6 -6
- package/dist/generators/server/resources/pom.xml +7 -7
- package/dist/generators/spring-boot/generator.js +2 -3
- package/dist/generators/spring-boot/resources/spring-boot-dependencies.pom +115 -105
- package/dist/generators/spring-boot/templates/src/main/java/_package_/config/SecurityJwtConfiguration.java.ejs +0 -1
- package/dist/generators/spring-boot/templates/src/main/java/_package_/security/DomainUserDetailsService.java.ejs +61 -5
- package/dist/generators/spring-boot/templates/src/main/java/_package_/security/SecurityUtils.java.ejs +29 -1
- package/dist/generators/spring-boot/templates/src/main/java/_package_/web/rest/AuthenticateController.java.ejs +11 -5
- package/dist/generators/spring-boot/templates/src/test/java/_package_/security/SecurityUtilsUnitTest_imperative.java.ejs +35 -11
- package/dist/generators/spring-boot/templates/src/test/java/_package_/security/SecurityUtilsUnitTest_reactive.java.ejs +35 -6
- package/dist/generators/spring-boot/templates/src/test/java/_package_/security/jwt/JwtAuthenticationTestUtils.java.ejs +3 -2
- package/dist/generators/spring-cache/resources/gradle/libs.versions.toml +1 -1
- package/dist/generators/vue/cleanup.js +7 -1
- package/dist/generators/vue/files-vue.js +3 -8
- package/dist/generators/vue/resources/package.json +20 -20
- package/dist/generators/vue/templates/src/main/webapp/app/account/account.service.ts.ejs +9 -9
- package/dist/generators/vue/templates/src/main/webapp/app/account/activate/activate.component.spec.ts.ejs +21 -7
- package/dist/generators/vue/templates/src/main/webapp/app/account/activate/activate.component.ts.ejs +23 -9
- package/dist/generators/vue/templates/src/main/webapp/app/account/activate/activate.service.ts.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/account/activate/activate.vue.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/account/change-password/change-password.vue.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/account/login-form/login-form.component.spec.ts.ejs +22 -10
- package/dist/generators/vue/templates/src/main/webapp/app/account/login-form/login-form.component.ts.ejs +24 -5
- package/dist/generators/vue/templates/src/main/webapp/app/account/login-modal.ts.ejs +38 -0
- package/dist/generators/vue/templates/src/main/webapp/app/account/login.service.spec.ts.ejs +0 -4
- package/dist/generators/vue/templates/src/main/webapp/app/account/login.service.ts.ejs +3 -25
- package/dist/generators/vue/templates/src/main/webapp/app/account/register/register.component.spec.ts.ejs +24 -8
- package/dist/generators/vue/templates/src/main/webapp/app/account/register/register.component.ts.ejs +23 -9
- package/dist/generators/vue/templates/src/main/webapp/app/account/register/register.service.ts.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/account/register/register.vue.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/account/reset-password/finish/reset-password-finish.component.spec.ts.ejs +20 -4
- package/dist/generators/vue/templates/src/main/webapp/app/account/reset-password/finish/reset-password-finish.component.ts.ejs +23 -13
- package/dist/generators/vue/templates/src/main/webapp/app/account/reset-password/finish/reset-password-finish.vue.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/account/settings/settings.vue.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/admin/configuration/configuration.service.ts.ejs +2 -2
- package/dist/generators/vue/templates/src/main/webapp/app/admin/gateway/gateway.service.ts.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/admin/health/health.service.ts.ejs +10 -10
- package/dist/generators/vue/templates/src/main/webapp/app/admin/logs/logs.service.ts.ejs +2 -2
- package/dist/generators/vue/templates/src/main/webapp/app/admin/metrics/metrics-modal.vue.ejs +2 -2
- package/dist/generators/vue/templates/src/main/webapp/app/admin/metrics/metrics.service.ts.ejs +2 -2
- package/dist/generators/vue/templates/src/main/webapp/app/admin/tracker/tracker.service.ts.ejs +5 -5
- package/dist/generators/vue/templates/src/main/webapp/app/admin/user-management/user-management.service.ts.ejs +6 -6
- package/dist/generators/vue/templates/src/main/webapp/app/app.component.ts.ejs +29 -7
- package/dist/generators/vue/templates/src/main/webapp/app/app.vue.ejs +19 -1
- package/dist/generators/vue/templates/src/main/webapp/app/core/error/error.component.spec.ts.ejs +66 -51
- package/dist/generators/vue/templates/src/main/webapp/app/core/error/error.component.ts.ejs +30 -8
- package/dist/generators/vue/templates/src/main/webapp/app/core/home/home.component.spec.ts.ejs +41 -11
- package/dist/generators/vue/templates/src/main/webapp/app/core/home/home.component.ts.ejs +10 -11
- package/dist/generators/vue/templates/src/main/webapp/app/core/home/home.vue.ejs +2 -2
- package/dist/generators/vue/templates/src/main/webapp/app/core/jhi-navbar/jhi-navbar.component.spec.ts.ejs +43 -16
- package/dist/generators/vue/templates/src/main/webapp/app/core/jhi-navbar/jhi-navbar.component.ts.ejs +14 -9
- package/dist/generators/vue/templates/src/main/webapp/app/core/jhi-navbar/jhi-navbar.vue.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.service.ts.ejs +7 -7
- package/dist/generators/vue/templates/src/main/webapp/app/entities/user/user.service.ts.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/locale/translation.service.ts.ejs +5 -5
- package/dist/generators/vue/templates/src/main/webapp/app/main.ts.ejs +18 -14
- package/dist/generators/vue/templates/src/main/webapp/app/shared/alert/alert.service.ts.ejs +4 -4
- package/dist/lib/testing/apply-patch-to-template.d.ts +13 -0
- package/dist/lib/testing/apply-patch-to-template.js +90 -0
- package/package.json +26 -26
package/dist/generators/vue/templates/src/main/webapp/app/account/activate/activate.component.ts.ejs
CHANGED
|
@@ -1,14 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
<%#
|
|
2
|
+
Copyright 2013-2025 the original author or authors from the JHipster project.
|
|
3
|
+
|
|
4
|
+
This file is part of the JHipster project, see https://www.jhipster.tech/
|
|
5
|
+
for more information.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
-%>
|
|
19
|
+
import { type Ref, defineComponent, inject, onMounted, ref } from 'vue';
|
|
2
20
|
import { useI18n } from 'vue-i18n';
|
|
3
|
-
import type LoginService from '@/account/login.service';
|
|
4
|
-
import ActivateService from './activate.service';
|
|
5
21
|
import { useRoute } from 'vue-router';
|
|
22
|
+
import { useLoginModal } from '@/account/login-modal';
|
|
23
|
+
import ActivateService from './activate.service';
|
|
6
24
|
|
|
7
25
|
export default defineComponent({
|
|
8
26
|
compatConfig: { MODE: 3 },
|
|
9
27
|
setup() {
|
|
10
28
|
const activateService = inject('activateService', () => new ActivateService(), true);
|
|
11
|
-
const
|
|
29
|
+
const { showLogin } = useLoginModal();
|
|
12
30
|
const route = useRoute();
|
|
13
31
|
|
|
14
32
|
const success: Ref<boolean> = ref(false);
|
|
@@ -26,13 +44,9 @@ export default defineComponent({
|
|
|
26
44
|
}
|
|
27
45
|
});
|
|
28
46
|
|
|
29
|
-
const openLogin = () => {
|
|
30
|
-
loginService.openLogin();
|
|
31
|
-
};
|
|
32
|
-
|
|
33
47
|
return {
|
|
34
48
|
activateService,
|
|
35
|
-
|
|
49
|
+
showLogin,
|
|
36
50
|
success,
|
|
37
51
|
error,
|
|
38
52
|
t$: useI18n().t,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<h1 v-text="t$('activate.title')">Activation</h1>
|
|
6
6
|
<div class="alert alert-success" v-if="success">
|
|
7
7
|
<span v-html="t$('activate.messages.success')"><strong>Your user account has been activated.</strong> Please </span>
|
|
8
|
-
<a class="alert-link" @click="
|
|
8
|
+
<a class="alert-link" @click="showLogin()" v-text="t$('global.messages.info.authenticated.link')">sign in</a>.
|
|
9
9
|
</div>
|
|
10
10
|
<div class="alert alert-danger" v-if="error" v-html="t$('activate.messages.error')">
|
|
11
11
|
<strong>Your user could not be activated.</strong> Please use the registration form to sign up.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<div class="row justify-content-center">
|
|
4
4
|
<div class="col-md-8 toastify-container">
|
|
5
5
|
<h2 v-if="username" id="password-title">
|
|
6
|
-
<span v-html="t$('password.title', { username
|
|
6
|
+
<span v-html="t$('password.title', { username })">
|
|
7
7
|
Password for [<strong>{{ username }}</strong
|
|
8
8
|
>]</span
|
|
9
9
|
>
|
|
@@ -1,15 +1,31 @@
|
|
|
1
|
+
<%#
|
|
2
|
+
Copyright 2013-2025 the original author or authors from the JHipster project.
|
|
3
|
+
|
|
4
|
+
This file is part of the JHipster project, see https://www.jhipster.tech/
|
|
5
|
+
for more information.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
-%>
|
|
1
19
|
import { vitest } from 'vitest';
|
|
2
|
-
import {
|
|
20
|
+
import { type MountingOptions, shallowMount } from '@vue/test-utils';
|
|
3
21
|
import axios from 'axios';
|
|
4
22
|
import sinon from 'sinon';
|
|
5
23
|
import { type RouteLocation } from 'vue-router';
|
|
6
|
-
import { PiniaVuePlugin } from 'pinia';
|
|
7
24
|
import { createTestingPinia } from '@pinia/testing';
|
|
8
25
|
|
|
9
|
-
import LoginService from '../login.service';
|
|
10
26
|
import AccountService from '../account.service';
|
|
11
|
-
import { useStore } from '@/store';
|
|
12
27
|
import LoginForm from './login-form.vue';
|
|
28
|
+
import { useStore } from '@/store';
|
|
13
29
|
|
|
14
30
|
type LoginFormComponentType = InstanceType<typeof LoginForm>;
|
|
15
31
|
|
|
@@ -20,10 +36,6 @@ vitest.mock('vue-router', () => ({
|
|
|
20
36
|
useRouter: () => ({ go: routerGoMock }),
|
|
21
37
|
}));
|
|
22
38
|
|
|
23
|
-
const pinia = createTestingPinia();
|
|
24
|
-
|
|
25
|
-
const store = useStore();
|
|
26
|
-
|
|
27
39
|
const axiosStub = {
|
|
28
40
|
get: sinon.stub(axios, 'get'),
|
|
29
41
|
post: sinon.stub(axios, 'post'),
|
|
@@ -37,7 +49,8 @@ describe('LoginForm Component', () => {
|
|
|
37
49
|
axiosStub.get.resolves({});
|
|
38
50
|
axiosStub.post.reset();
|
|
39
51
|
|
|
40
|
-
const
|
|
52
|
+
const pinia = createTestingPinia();
|
|
53
|
+
const store = useStore();
|
|
41
54
|
|
|
42
55
|
const globalOptions: MountingOptions<LoginFormComponentType>['global'] = {
|
|
43
56
|
stubs: {
|
|
@@ -51,7 +64,6 @@ describe('LoginForm Component', () => {
|
|
|
51
64
|
},
|
|
52
65
|
plugins: [pinia],
|
|
53
66
|
provide: {
|
|
54
|
-
loginService,
|
|
55
67
|
accountService: new AccountService(store),
|
|
56
68
|
},
|
|
57
69
|
};
|
|
@@ -1,11 +1,29 @@
|
|
|
1
|
+
<%#
|
|
2
|
+
Copyright 2013-2025 the original author or authors from the JHipster project.
|
|
3
|
+
|
|
4
|
+
This file is part of the JHipster project, see https://www.jhipster.tech/
|
|
5
|
+
for more information.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
-%>
|
|
1
19
|
import axios from 'axios';
|
|
2
|
-
import { defineComponent, inject, ref
|
|
20
|
+
import { type Ref, defineComponent, inject, ref } from 'vue';
|
|
3
21
|
import { useRoute, useRouter } from 'vue-router';
|
|
4
22
|
<%_ if (enableTranslation) { _%>
|
|
5
23
|
import { useI18n } from 'vue-i18n';
|
|
6
24
|
<%_ } _%>
|
|
25
|
+
import { useLoginModal } from '@/account/login-modal';
|
|
7
26
|
import type AccountService from '../account.service';
|
|
8
|
-
import type LoginService from '@/account/login.service';
|
|
9
27
|
|
|
10
28
|
export default defineComponent({
|
|
11
29
|
compatConfig: { MODE: 3 },
|
|
@@ -14,13 +32,14 @@ export default defineComponent({
|
|
|
14
32
|
const login: Ref<string> = ref(null);
|
|
15
33
|
const password: Ref<string> = ref(null);
|
|
16
34
|
const rememberMe: Ref<boolean> = ref(false);
|
|
35
|
+
|
|
36
|
+
const { hideLogin } = useLoginModal();
|
|
17
37
|
const route = useRoute();
|
|
18
38
|
const router = useRouter();
|
|
19
39
|
|
|
20
40
|
const previousState = () => router.go(-1);
|
|
21
41
|
|
|
22
42
|
const accountService = inject<AccountService>('accountService');
|
|
23
|
-
const loginService = inject<LoginService>('loginService');
|
|
24
43
|
|
|
25
44
|
const doLogin = async () => {
|
|
26
45
|
<%_ if (authenticationTypeJwt) { _%>
|
|
@@ -49,12 +68,12 @@ export default defineComponent({
|
|
|
49
68
|
<%_ } _%>
|
|
50
69
|
|
|
51
70
|
authenticationError.value = false;
|
|
52
|
-
|
|
71
|
+
hideLogin();
|
|
53
72
|
await accountService.retrieveAccount();
|
|
54
73
|
if (route.path === '/forbidden') {
|
|
55
74
|
previousState();
|
|
56
75
|
}
|
|
57
|
-
} catch
|
|
76
|
+
} catch {
|
|
58
77
|
authenticationError.value = true;
|
|
59
78
|
}
|
|
60
79
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<%#
|
|
2
|
+
Copyright 2013-2025 the original author or authors from the JHipster project.
|
|
3
|
+
|
|
4
|
+
This file is part of the JHipster project, see https://www.jhipster.tech/
|
|
5
|
+
for more information.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
-%>
|
|
19
|
+
import { ref } from 'vue';
|
|
20
|
+
import { defineStore } from 'pinia';
|
|
21
|
+
|
|
22
|
+
export const useLoginModal = defineStore('login', () => {
|
|
23
|
+
const loginModalOpen = ref(false);
|
|
24
|
+
|
|
25
|
+
function showLogin() {
|
|
26
|
+
loginModalOpen.value = true;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function hideLogin() {
|
|
30
|
+
loginModalOpen.value = false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
loginModalOpen,
|
|
35
|
+
showLogin,
|
|
36
|
+
hideLogin,
|
|
37
|
+
};
|
|
38
|
+
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import LoginService from './login.service';
|
|
2
|
-
<%_ if (!authenticationTypeJwt) { _%>
|
|
3
2
|
import axios from 'axios';
|
|
4
3
|
import sinon from 'sinon';
|
|
5
4
|
|
|
@@ -7,7 +6,6 @@ const axiosStub = {
|
|
|
7
6
|
get: sinon.stub(axios, 'get'),
|
|
8
7
|
post: sinon.stub(axios, 'post'),
|
|
9
8
|
};
|
|
10
|
-
<%_ } _%>
|
|
11
9
|
|
|
12
10
|
describe('Login Service test suite', () => {
|
|
13
11
|
let loginService: LoginService;
|
|
@@ -66,11 +64,9 @@ describe('Login Service test suite', () => {
|
|
|
66
64
|
});
|
|
67
65
|
<%_ } _%>
|
|
68
66
|
|
|
69
|
-
<%_ if (!authenticationTypeJwt) { _%>
|
|
70
67
|
it('should call global logout when asked to', () => {
|
|
71
68
|
loginService.logout();
|
|
72
69
|
|
|
73
70
|
expect(axiosStub.post.calledWith('api/logout')).toBeTruthy();
|
|
74
71
|
});
|
|
75
|
-
<%_ } _%>
|
|
76
72
|
});
|
|
@@ -1,28 +1,8 @@
|
|
|
1
|
-
<%_ if (!authenticationTypeOauth2) { _%>
|
|
2
|
-
import Vue from 'vue';
|
|
3
|
-
<%_ } _%>
|
|
4
|
-
<%_ if (!authenticationTypeJwt) { _%>
|
|
5
1
|
import axios, { type AxiosPromise } from 'axios';
|
|
6
|
-
<%_ } _%>
|
|
7
2
|
|
|
8
3
|
export default class LoginService {
|
|
9
|
-
<%_ if (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
constructor({ emit }: { emit: (event: string, ...args: any[]) => void }) {
|
|
13
|
-
this.emit = emit;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public openLogin(): void {
|
|
17
|
-
this.emit('bv::show::modal', 'login-page');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public hideLogin(): void {
|
|
21
|
-
this.emit('bv::hide::modal', 'login-page');
|
|
22
|
-
}
|
|
23
|
-
<%_ } else { _%>
|
|
24
|
-
|
|
25
|
-
public login(loc: { href: string; hostname: string; pathname: string; port?: string } = window.location) {
|
|
4
|
+
<%_ if (authenticationTypeOauth2) { _%>
|
|
5
|
+
login(loc: { href: string; hostname: string; pathname: string; port?: string } = window.location) {
|
|
26
6
|
const port = loc.port ? `:${loc.port}` : '';
|
|
27
7
|
let contextPath = loc.pathname;
|
|
28
8
|
if (contextPath.endsWith('accessdenied')) {
|
|
@@ -39,10 +19,8 @@ export default class LoginService {
|
|
|
39
19
|
loc.href = `//${loc.hostname}${port}${contextPath}oauth2/authorization/oidc`;
|
|
40
20
|
}
|
|
41
21
|
<%_ } _%>
|
|
42
|
-
<%_ if (!authenticationTypeJwt) { _%>
|
|
43
22
|
|
|
44
|
-
|
|
23
|
+
logout(): AxiosPromise<any> {
|
|
45
24
|
return axios.post('api/logout');
|
|
46
25
|
}
|
|
47
|
-
<%_ } _%>
|
|
48
26
|
}
|
|
@@ -1,13 +1,31 @@
|
|
|
1
|
+
<%#
|
|
2
|
+
Copyright 2013-2025 the original author or authors from the JHipster project.
|
|
3
|
+
|
|
4
|
+
This file is part of the JHipster project, see https://www.jhipster.tech/
|
|
5
|
+
for more information.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
-%>
|
|
1
19
|
import { vitest } from 'vitest';
|
|
2
20
|
import { computed } from 'vue';
|
|
3
21
|
import { shallowMount } from '@vue/test-utils';
|
|
22
|
+
import { createTestingPinia } from '@pinia/testing';
|
|
4
23
|
import axios from 'axios';
|
|
5
24
|
import sinon from 'sinon';
|
|
6
25
|
|
|
7
26
|
import { EMAIL_ALREADY_USED_TYPE, LOGIN_ALREADY_USED_TYPE } from '@/constants';
|
|
27
|
+
import { useLoginModal } from '@/account/login-modal';
|
|
8
28
|
import Register from './register.vue';
|
|
9
|
-
import RegisterService from './register.service';
|
|
10
|
-
import LoginService from '../login.service';
|
|
11
29
|
|
|
12
30
|
type RegisterComponentType = InstanceType<typeof Register>;
|
|
13
31
|
|
|
@@ -18,7 +36,6 @@ const axiosStub = {
|
|
|
18
36
|
|
|
19
37
|
describe('Register Component', () => {
|
|
20
38
|
let register: RegisterComponentType;
|
|
21
|
-
let loginService: LoginService;
|
|
22
39
|
const filledRegisterAccount = {
|
|
23
40
|
email: 'jhi@pster.net',
|
|
24
41
|
langKey: '<%= nativeLanguage %>',
|
|
@@ -29,13 +46,11 @@ describe('Register Component', () => {
|
|
|
29
46
|
beforeEach(() => {
|
|
30
47
|
axiosStub.get.resolves({});
|
|
31
48
|
axiosStub.post.reset();
|
|
32
|
-
loginService = new LoginService({ emit: vitest.fn() });
|
|
33
|
-
vitest.spyOn(loginService, 'openLogin');
|
|
34
49
|
|
|
35
50
|
const wrapper = shallowMount(Register, {
|
|
36
51
|
global: {
|
|
52
|
+
plugins: [createTestingPinia()],
|
|
37
53
|
provide: {
|
|
38
|
-
loginService,
|
|
39
54
|
currentLanguage: computed(() => '<%= nativeLanguage %>'),
|
|
40
55
|
},
|
|
41
56
|
},
|
|
@@ -55,8 +70,9 @@ describe('Register Component', () => {
|
|
|
55
70
|
});
|
|
56
71
|
|
|
57
72
|
it('should open login modal when asked to', () => {
|
|
58
|
-
|
|
59
|
-
|
|
73
|
+
const login = useLoginModal();
|
|
74
|
+
register.showLogin();
|
|
75
|
+
expect(login.showLogin).toHaveBeenCalledOnce();
|
|
60
76
|
});
|
|
61
77
|
|
|
62
78
|
it('should register when password match', async () => {
|
package/dist/generators/vue/templates/src/main/webapp/app/account/register/register.component.ts.ejs
CHANGED
|
@@ -1,10 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
<%#
|
|
2
|
+
Copyright 2013-2025 the original author or authors from the JHipster project.
|
|
3
|
+
|
|
4
|
+
This file is part of the JHipster project, see https://www.jhipster.tech/
|
|
5
|
+
for more information.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
-%>
|
|
19
|
+
import { type Ref, computed, defineComponent, inject, ref } from 'vue';
|
|
2
20
|
<%_ if (enableTranslation) { _%>
|
|
3
21
|
import { useI18n } from 'vue-i18n';
|
|
4
22
|
<%_ } _%>
|
|
5
|
-
import { useVuelidate } from '@vuelidate/core'
|
|
23
|
+
import { useVuelidate } from '@vuelidate/core';
|
|
6
24
|
import { email, helpers, maxLength, minLength, required, sameAs } from '@vuelidate/validators';
|
|
7
|
-
import
|
|
25
|
+
import { useLoginModal } from '@/account/login-modal';
|
|
8
26
|
import RegisterService from '@/account/register/register.service';
|
|
9
27
|
import { EMAIL_ALREADY_USED_TYPE, LOGIN_ALREADY_USED_TYPE } from '@/constants';
|
|
10
28
|
|
|
@@ -43,7 +61,7 @@ export default defineComponent({
|
|
|
43
61
|
};
|
|
44
62
|
},
|
|
45
63
|
setup() {
|
|
46
|
-
const
|
|
64
|
+
const { showLogin } = useLoginModal();
|
|
47
65
|
const registerService = inject('registerService', () => new RegisterService(), true);
|
|
48
66
|
const currentLanguage = inject('currentLanguage', () => computed(() => navigator.language ?? '<%- nativeLanguage %>'), true);
|
|
49
67
|
|
|
@@ -59,12 +77,8 @@ export default defineComponent({
|
|
|
59
77
|
password: undefined,
|
|
60
78
|
});
|
|
61
79
|
|
|
62
|
-
const openLogin = () => {
|
|
63
|
-
loginService.openLogin();
|
|
64
|
-
};
|
|
65
|
-
|
|
66
80
|
return {
|
|
67
|
-
|
|
81
|
+
showLogin,
|
|
68
82
|
currentLanguage,
|
|
69
83
|
registerService,
|
|
70
84
|
error,
|
|
@@ -209,7 +209,7 @@
|
|
|
209
209
|
<p></p>
|
|
210
210
|
<div class="alert alert-warning">
|
|
211
211
|
<span v-text="t$('global.messages.info.authenticated.prefix')">If you want to </span>
|
|
212
|
-
<a class="alert-link" @click="
|
|
212
|
+
<a class="alert-link" @click="showLogin()" v-text="t$('global.messages.info.authenticated.link')">sign in</a
|
|
213
213
|
><span v-html="t$('global.messages.info.authenticated.suffix')"
|
|
214
214
|
>, you can try the default accounts:<br />- Administrator (login="admin" and password="admin") <br />- User (login="user" and
|
|
215
215
|
password="user").</span
|
|
@@ -1,8 +1,26 @@
|
|
|
1
|
+
<%#
|
|
2
|
+
Copyright 2013-2025 the original author or authors from the JHipster project.
|
|
3
|
+
|
|
4
|
+
This file is part of the JHipster project, see https://www.jhipster.tech/
|
|
5
|
+
for more information.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
-%>
|
|
1
19
|
import axios from 'axios';
|
|
2
20
|
import sinon from 'sinon';
|
|
3
21
|
import { shallowMount } from '@vue/test-utils';
|
|
4
22
|
import ResetPasswordFinish from './reset-password-finish.vue';
|
|
5
|
-
import
|
|
23
|
+
import { createTestingPinia } from '@pinia/testing';
|
|
6
24
|
|
|
7
25
|
type ResetPasswordFinishComponentType = InstanceType<typeof ResetPasswordFinish>;
|
|
8
26
|
|
|
@@ -18,9 +36,7 @@ describe('Reset Component Finish', () => {
|
|
|
18
36
|
axiosStub.post.reset();
|
|
19
37
|
const wrapper = shallowMount(ResetPasswordFinish, {
|
|
20
38
|
global: {
|
|
21
|
-
|
|
22
|
-
loginService: {},
|
|
23
|
-
},
|
|
39
|
+
plugins: [createTestingPinia()],
|
|
24
40
|
},
|
|
25
41
|
});
|
|
26
42
|
resetPasswordFinish = wrapper.vm;
|
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
<%#
|
|
2
|
+
Copyright 2013-2025 the original author or authors from the JHipster project.
|
|
3
|
+
|
|
4
|
+
This file is part of the JHipster project, see https://www.jhipster.tech/
|
|
5
|
+
for more information.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
-%>
|
|
19
|
+
import { type Ref, defineComponent, inject, ref } from 'vue';
|
|
3
20
|
import { useI18n } from 'vue-i18n';
|
|
4
|
-
<%_ } _%>
|
|
5
21
|
import axios from 'axios';
|
|
6
|
-
import { useVuelidate } from '@vuelidate/core'
|
|
22
|
+
import { useVuelidate } from '@vuelidate/core';
|
|
7
23
|
import { maxLength, minLength, required, sameAs } from '@vuelidate/validators';
|
|
8
|
-
import
|
|
24
|
+
import { useLoginModal } from '@/account/login-modal';
|
|
9
25
|
|
|
10
26
|
export default defineComponent({
|
|
11
27
|
compatConfig: { MODE: 3 },
|
|
@@ -31,7 +47,7 @@ export default defineComponent({
|
|
|
31
47
|
this.keyMissing = !this.key;
|
|
32
48
|
},
|
|
33
49
|
setup() {
|
|
34
|
-
const
|
|
50
|
+
const { showLogin } = useLoginModal();
|
|
35
51
|
|
|
36
52
|
const doNotMatch: Ref<string> = ref(null);
|
|
37
53
|
const success: Ref<string> = ref(null);
|
|
@@ -43,12 +59,8 @@ export default defineComponent({
|
|
|
43
59
|
confirmPassword: null,
|
|
44
60
|
});
|
|
45
61
|
|
|
46
|
-
const openLogin = () => {
|
|
47
|
-
loginService.openLogin();
|
|
48
|
-
};
|
|
49
|
-
|
|
50
62
|
return {
|
|
51
|
-
|
|
63
|
+
showLogin,
|
|
52
64
|
doNotMatch,
|
|
53
65
|
success,
|
|
54
66
|
error,
|
|
@@ -56,9 +68,7 @@ export default defineComponent({
|
|
|
56
68
|
key,
|
|
57
69
|
resetAccount,
|
|
58
70
|
v$: useVuelidate(),
|
|
59
|
-
<%_ if (enableTranslation) { _%>
|
|
60
71
|
t$: useI18n().t,
|
|
61
|
-
<%_ } _%>
|
|
62
72
|
};
|
|
63
73
|
},
|
|
64
74
|
methods: {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
<div class="alert alert-success" v-if="success">
|
|
18
18
|
<span v-html="t$('reset.finish.messages.success')"><strong>Your password had been reset.</strong> Please </span>
|
|
19
|
-
<a class="alert-link" @click="
|
|
19
|
+
<a class="alert-link" @click="showLogin()" v-text="t$('global.messages.info.authenticated.link')">sign in</a>
|
|
20
20
|
</div>
|
|
21
21
|
<div class="alert alert-danger" v-if="doNotMatch">
|
|
22
22
|
<p v-text="t$('global.messages.error.dontmatch')">The password and its confirmation do not match!</p>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<div class="row justify-content-center">
|
|
4
4
|
<div class="col-md-8 toastify-container">
|
|
5
5
|
<h2 v-if="username" id="settings-title">
|
|
6
|
-
<span v-html="t$('settings.title', { username
|
|
6
|
+
<span v-html="t$('settings.title', { username })">
|
|
7
7
|
User settings for [
|
|
8
8
|
<strong>
|
|
9
9
|
{{ username }}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
|
|
3
3
|
export default class ConfigurationService {
|
|
4
|
-
|
|
4
|
+
loadConfiguration(): Promise<any> {
|
|
5
5
|
return new Promise(resolve => {
|
|
6
6
|
axios.get('management/configprops').then(res => {
|
|
7
7
|
const properties = [];
|
|
@@ -21,7 +21,7 @@ export default class ConfigurationService {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
loadEnvConfiguration(): Promise<any> {
|
|
25
25
|
return new Promise(resolve => {
|
|
26
26
|
axios.get<any>('management/env').then(res => {
|
|
27
27
|
const properties = {};
|