mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-16 18:13:06 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90bed3cb30 | ||
|
|
53325a1e39 | ||
|
|
626e40dd67 | ||
|
|
2f23583acb | ||
|
|
031788df64 | ||
|
|
26fbcca7a2 | ||
|
|
07f44dde89 | ||
|
|
c5f07c7d79 |
@@ -4,7 +4,7 @@
|
||||
"bpmHost": "{protocol}//{hostname}{:port}",
|
||||
"identityHost": "{protocol}//{hostname}{:port}/auth/admin/realms/alfresco",
|
||||
"loginRoute": "login",
|
||||
"providers": "ALL",
|
||||
"providers": "ECM",
|
||||
"contextRootBpm": "activiti-app",
|
||||
"authType": "BASIC",
|
||||
"locale": "en",
|
||||
|
||||
@@ -56,10 +56,17 @@ import { ProcessCloudLayoutComponent } from './components/cloud/process-cloud-la
|
||||
import { ServiceTaskListCloudDemoComponent } from './components/cloud/service-task-list-cloud-demo.component';
|
||||
import { AspectListSampleComponent } from './components/aspect-list-sample/aspect-list-sample.component';
|
||||
import { SearchFilterChipsComponent } from './components/search/search-filter-chips.component';
|
||||
import { ForgotPasswordComponent } from 'lib/core/src/lib/forgot-password/forgot-password.component';
|
||||
import { ForgotPasswordRuleGuard } from 'lib/core/src/lib/forgot-password/forgot-password-guard';
|
||||
|
||||
export const appRoutes: Routes = [
|
||||
{ path: 'login', loadChildren: () => import('./components/login/login.module').then(m => m.AppLoginModule) },
|
||||
{ path: 'logout', component: LogoutComponent },
|
||||
{
|
||||
path: 'forgot-password',
|
||||
component: ForgotPasswordComponent,
|
||||
canActivate: [ForgotPasswordRuleGuard]
|
||||
},
|
||||
{
|
||||
path: 'settings',
|
||||
loadChildren: () => import('./components/settings/settings.module').then(m => m.AppSettingsModule)
|
||||
|
||||
@@ -28,6 +28,15 @@
|
||||
{{ 'LOGIN.SHOW_REMEMBERME'| translate }}
|
||||
</mat-slide-toggle>
|
||||
</p>
|
||||
<p class="app-toggle">
|
||||
<mat-slide-toggle
|
||||
id="adf-toggle-show-forgot-password"
|
||||
color="primary"
|
||||
(change)="toggleForgotPassword()"
|
||||
[checked]="showForgotPassword">
|
||||
{{ 'LOGIN.FORGOT-PASSWORD.FORGOT-PASSWORD' | translate }}
|
||||
</mat-slide-toggle>
|
||||
</p>
|
||||
<p class="app-toggle">
|
||||
<mat-slide-toggle
|
||||
id="adf-toggle-show-successRoute"
|
||||
@@ -81,6 +90,7 @@
|
||||
[logoImageUrl]="customLogoImageURL"
|
||||
[showLoginActions]="showFooter"
|
||||
[showRememberMe]="showFooter && showRememberMe"
|
||||
[showForgotPassword]="showForgotPassword"
|
||||
copyrightText="{{ 'application.copyright' | adfAppConfig }}"
|
||||
(success)="onLogin()"
|
||||
(error)="onError($event)">
|
||||
|
||||
@@ -33,6 +33,7 @@ export class LoginComponent {
|
||||
disableCsrf = false;
|
||||
showFooter = true;
|
||||
showRememberMe = true;
|
||||
showForgotPassword = true;
|
||||
customSuccessRoute = false;
|
||||
customLogoImage = false;
|
||||
|
||||
@@ -60,6 +61,10 @@ export class LoginComponent {
|
||||
this.showRememberMe = !this.showRememberMe;
|
||||
}
|
||||
|
||||
toggleForgotPassword() {
|
||||
this.showForgotPassword = !this.showForgotPassword;
|
||||
}
|
||||
|
||||
toggleSuccessRoute() {
|
||||
this.customSuccessRoute = !this.customSuccessRoute;
|
||||
if (!this.customSuccessRoute) {
|
||||
|
||||
@@ -66,6 +66,7 @@ import { AppConfigService } from './app-config/app-config.service';
|
||||
import { StorageService } from './common/services/storage.service';
|
||||
import { AlfrescoApiLoaderService, createAlfrescoApiInstance } from './api-factories/alfresco-api-v2-loader.service';
|
||||
import { AlfrescoApiServiceWithAngularBasedHttpClient } from './api-factories/alfresco-api-service-with-angular-based-http-client';
|
||||
import { ForgotPasswordModule } from './forgot-password/forgot-password.module';
|
||||
|
||||
interface Config {
|
||||
readonly useAngularBasedHttpClientInAlfrescoJs: boolean;
|
||||
@@ -96,6 +97,7 @@ const defaultConfig: Config = { useAngularBasedHttpClientInAlfrescoJs: false };
|
||||
CommentsModule,
|
||||
CommentListModule,
|
||||
LoginModule,
|
||||
ForgotPasswordModule,
|
||||
LanguageMenuModule,
|
||||
InfoDrawerModule,
|
||||
DataTableModule,
|
||||
@@ -135,6 +137,7 @@ const defaultConfig: Config = { useAngularBasedHttpClientInAlfrescoJs: false };
|
||||
CommentsModule,
|
||||
CommentListModule,
|
||||
LoginModule,
|
||||
ForgotPasswordModule,
|
||||
LanguageMenuModule,
|
||||
InfoDrawerModule,
|
||||
DataTableModule,
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CanActivate, ActivatedRouteSnapshot } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { AuthenticationService } from '../auth/services/authentication.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ForgotPasswordRuleGuard implements CanActivate {
|
||||
constructor(private authService: AuthenticationService) {}
|
||||
|
||||
canActivate(_: ActivatedRouteSnapshot): Observable<boolean> | Promise<boolean> | boolean {
|
||||
return this.authService.isECMProvider();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<div class="adf-forgot-password" *ngIf="!passwordResetStatus">
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<mat-card-title class="adf-forgot-password-title">
|
||||
{{ 'RECOVER-PASSWORD.RECOVER-PASSWORD' | translate }}
|
||||
</mat-card-title>
|
||||
</mat-card-header>
|
||||
<hr>
|
||||
|
||||
<mat-card-content>
|
||||
<p class="adf-forgot-password-filler">{{ 'RECOVER-PASSWORD.MESSAGES.FILLER' | translate }}</p>
|
||||
<form [formGroup]="forgotPasswordForm">
|
||||
<div class="adf-orgot-paassword-form-field">
|
||||
<label class="adf-forgot-password-label">
|
||||
{{ 'RECOVER-PASSWORD.MESSAGES.ENTER-USERNAME' | translate }}
|
||||
</label>
|
||||
|
||||
<input class="adf-forgot-password-field" placeholder="{{ 'RECOVER-PASSWORD.PLACEHOLDERS.USERNAME' | translate }}"
|
||||
formControlName="userName" required>
|
||||
</div>
|
||||
|
||||
<button type="button" (click)="sendInstructions()" class="adf-send-instructions-button"
|
||||
[attr.aria-label]="'RECOVER-PASSWORD.BUTTONS.SEND-INSTRUCTIONS' | translate" [disabled]="isButtonDisabled()"
|
||||
mat-raised-button color="primary">
|
||||
{{ 'RECOVER-PASSWORD.BUTTONS.SEND-INSTRUCTIONS' | translate }}
|
||||
</button>
|
||||
|
||||
<button mat-button class="adf-close-button" (click)="close()">{{ 'RECOVER-PASSWORD.BUTTONS.CLOSE' | translate}}</button>
|
||||
</form>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
|
||||
<div class="adf-forgot-password" *ngIf="passwordResetStatus">
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<mat-card-title class="adf-forgot-password-title">
|
||||
{{ 'RECOVER-PASSWORD.RECOVER-PASSWORD' | translate }}
|
||||
</mat-card-title>
|
||||
</mat-card-header>
|
||||
<hr>
|
||||
|
||||
<mat-card-content>
|
||||
<div>
|
||||
<p class="adf-password-reset-link-message">
|
||||
{{ 'RECOVER-PASSWORD.MESSAGES.RESET-PASSWORD-EMAIL-SENT' | translate }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<button mat-button class="adf-close-button" (click)="close()">{{ 'RECOVER-PASSWORD.BUTTONS.CLOSE' | translate}}</button>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
@@ -0,0 +1,111 @@
|
||||
.adf-forgot-password {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
border-radius: 12px;
|
||||
background-color: var(--theme-forgot-password-background);
|
||||
|
||||
mat-card {
|
||||
padding: 24px;
|
||||
width: 371px;
|
||||
}
|
||||
|
||||
::ng-deep .mat-card-header-text {
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
.adf-forgot-password-title {
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-size: 20px;
|
||||
line-height: 28px;
|
||||
letter-spacing: 0.15px;
|
||||
color: var(--theme-forgot-password-title-color);
|
||||
padding: 2px 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
hr {
|
||||
margin: 12px 0;
|
||||
}
|
||||
|
||||
.adf-forgot-password-filler {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 8px 0;
|
||||
height: 16px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-size: 12px;
|
||||
line-height: 16px;
|
||||
letter-spacing: 0.5px;
|
||||
color: var(--theme-forgot-password-label-color);
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
|
||||
.adf-forgot-password-form-field {
|
||||
height: 64px;
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.adf-forgot-password-label {
|
||||
height: 32px;
|
||||
padding: 6px 0;
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
letter-spacing: 0.15px;
|
||||
color: var(--theme-forgot-password-title-color);
|
||||
}
|
||||
|
||||
.adf-forgot-password-field {
|
||||
text-decoration: none;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
background: var(--theme-forgot-password-input-background-color);
|
||||
border-radius: 6px;
|
||||
width: 100%;
|
||||
border: none;
|
||||
outline: none;
|
||||
margin-top: 10px;
|
||||
padding: 0 6px;
|
||||
}
|
||||
|
||||
.adf-send-instructions-button {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 4px 12px;
|
||||
height: 32px;
|
||||
background: var(--theme-forgot-password-button-background-color);
|
||||
border-radius: 6px;
|
||||
margin: 24px 0 0;
|
||||
}
|
||||
|
||||
.adf-close-button {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: var(--theme-forgot-password-input-background-color);
|
||||
color: var(--theme-forgot-password-title-color);
|
||||
margin-top: 8px;
|
||||
padding: 4px 12px;
|
||||
height: 32px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.adf-password-reset-link-message {
|
||||
height: 52px;
|
||||
padding: 6px 0;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
letter-spacing: 0.25px;
|
||||
color: var(--theme-forgot-password-title-color);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2019 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { Router } from '@angular/router';
|
||||
import { CoreTestingModule } from '../testing/core.testing.module';
|
||||
import { ForgotPasswordComponent } from './forgot-password.component';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { AlfrescoApiServiceMock } from '../mock/alfresco-api.service.mock';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
||||
describe('ForgotPasswordComponent', () => {
|
||||
let component: ForgotPasswordComponent;
|
||||
let fixture: ComponentFixture<ForgotPasswordComponent>;
|
||||
let router: Router;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, RouterTestingModule],
|
||||
declarations: [ForgotPasswordComponent],
|
||||
providers: [
|
||||
{
|
||||
provide: AlfrescoApiService,
|
||||
useClass: AlfrescoApiServiceMock
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
fixture = TestBed.createComponent(ForgotPasswordComponent);
|
||||
component = fixture.componentInstance;
|
||||
router = TestBed.inject(Router);
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fixture.destroy();
|
||||
});
|
||||
|
||||
it('send instructions button should be disabled by default', async () => {
|
||||
expect(component.isButtonDisabled).toBeTruthy();
|
||||
});
|
||||
|
||||
it('send instructions button should be disabled if username field is empty', async () => {
|
||||
component.forgotPasswordForm.controls['userName'].setValue('');
|
||||
|
||||
expect(component.isButtonDisabled).toBeTruthy();
|
||||
});
|
||||
|
||||
it('send instructions button should be enabled when username field is not empty', async () => {
|
||||
component.forgotPasswordForm.controls['userName'].setValue('userABC');
|
||||
spyOn(component, 'isButtonDisabled').and.callThrough();
|
||||
const sendInstructionsBtn = fixture.debugElement.nativeElement.querySelector('.adf-send-instructions-button');
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
expect(component.isButtonDisabled).toHaveBeenCalled();
|
||||
expect(sendInstructionsBtn.disabled).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should send instructions to the email id corresponding to the username when the send instructions button is clicked', async () => {
|
||||
component.forgotPasswordForm.controls['userName'].setValue('userABC');
|
||||
spyOn(component, 'sendInstructions').and.callThrough();
|
||||
|
||||
const sendInstructionsBtn = fixture.debugElement.nativeElement.querySelector('.adf-send-instructions-button');
|
||||
sendInstructionsBtn.dispatchEvent(new Event('click'));
|
||||
|
||||
expect(component.sendInstructions).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should route user back to login page when the close button is clicked', async () => {
|
||||
spyOn(component, 'close').and.callThrough();
|
||||
spyOn(router, 'navigate');
|
||||
|
||||
const closeBtn = fixture.debugElement.nativeElement.querySelector('.adf-close-button');
|
||||
closeBtn.dispatchEvent(new Event('click'));
|
||||
|
||||
expect(component.close).toHaveBeenCalled();
|
||||
expect(router.navigate).toHaveBeenCalledWith(['./login']);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,69 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2019 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { PeopleApi, ClientBody } from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-forgot-password',
|
||||
templateUrl: './forgot-password.component.html',
|
||||
styleUrls: ['./forgot-password.component.scss']
|
||||
})
|
||||
export class ForgotPasswordComponent implements OnInit {
|
||||
private peopleApi: PeopleApi;
|
||||
forgotPasswordForm: FormGroup;
|
||||
isSaveInProgress: boolean = false;
|
||||
passwordResetStatus: boolean = false;
|
||||
|
||||
constructor(
|
||||
private apiService: AlfrescoApiService,
|
||||
private formBuilder: FormBuilder,
|
||||
private router: Router) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.passwordResetStatus = false;
|
||||
this.forgotPasswordForm = this.formBuilder.group({
|
||||
userName: ['', [Validators.required]]
|
||||
});
|
||||
}
|
||||
|
||||
get peopleApiInstance() {
|
||||
return (
|
||||
this.peopleApi ||
|
||||
(this.peopleApi = new PeopleApi(this.apiService.getInstance()))
|
||||
);
|
||||
}
|
||||
|
||||
sendInstructions() {
|
||||
this.isSaveInProgress = true;
|
||||
this.passwordResetStatus = true;
|
||||
|
||||
this.peopleApiInstance.requestPasswordReset(
|
||||
this.forgotPasswordForm.controls.userName.value, { 'client': 'workspace' } as ClientBody);
|
||||
}
|
||||
|
||||
isButtonDisabled(): boolean {
|
||||
return this.forgotPasswordForm.invalid || this.isSaveInProgress;
|
||||
}
|
||||
|
||||
close() {
|
||||
this.router.navigate(['./login']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2019 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { ForgotPasswordComponent } from './forgot-password.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule,
|
||||
MaterialModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
CommonModule,
|
||||
TranslateModule
|
||||
],
|
||||
declarations: [
|
||||
ForgotPasswordComponent
|
||||
],
|
||||
exports: [
|
||||
ForgotPasswordComponent
|
||||
]
|
||||
})
|
||||
export class ForgotPasswordModule { }
|
||||
@@ -0,0 +1,18 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2019 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './public-api';
|
||||
@@ -0,0 +1,19 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2019 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './forgot-password.module';
|
||||
export * from './forgot-password.component';
|
||||
@@ -310,12 +310,32 @@
|
||||
"HELP": "NEED HELP?",
|
||||
"REGISTER": "REGISTER"
|
||||
},
|
||||
"FORGOT-PASSWORD": {
|
||||
"FORGOT-PASSWORD": "Forgot Password?"
|
||||
},
|
||||
"DIALOG": {
|
||||
"CANCEL": "Cancel",
|
||||
"CHOOSE": "Choose",
|
||||
"LOGIN": "Sign in"
|
||||
}
|
||||
},
|
||||
"RCOVER-PASSWORD": {
|
||||
"RECOVER-PASSWORD": "Recover Password",
|
||||
"MESSAGES": {
|
||||
"USERNAME-REQUIRED": "Required",
|
||||
"FILLER": "Don't worry, happens to the best of us.",
|
||||
"ENTER-USERNAME": "Enter username for your account",
|
||||
"INVALID-USERNAME": "You've entered an invalid username",
|
||||
"RESET-PASSWORD-EMAIL-SENT": "An email has been sent to your registered Email ID. Please click the link when you get it."
|
||||
},
|
||||
"PLACEHOLDERS": {
|
||||
"USERNAME": "Username"
|
||||
},
|
||||
"BUTTONS": {
|
||||
"SEND-INSTRUCTIONS": "Send Instructions",
|
||||
"CLOSE": "Close"
|
||||
}
|
||||
},
|
||||
"ADF-DATATABLE": {
|
||||
"EMPTY": {
|
||||
"HEADER": "This list is empty",
|
||||
|
||||
@@ -168,6 +168,13 @@
|
||||
{{ 'LOGIN.LABEL.REMEMBER' | translate }}
|
||||
</mat-checkbox>
|
||||
</div>
|
||||
<div *ngIf="showForgotPassword && isECMProvider()" class="adf-login-action">
|
||||
<div id="adf-login-forgot-password">
|
||||
<a class="adf-login-forgot-password-link" (click)="forgotPassword()">
|
||||
{{ 'LOGIN.FORGOT-PASSWORD.FORGOT-PASSWORD' | translate }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="implicitFlow">
|
||||
<button
|
||||
|
||||
@@ -237,6 +237,11 @@
|
||||
opacity: 0.87;
|
||||
}
|
||||
|
||||
.adf-login-forgot-password-link {
|
||||
cursor: pointer;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.adf-login__field {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
|
||||
@@ -306,6 +306,20 @@ describe('LoginComponent', () => {
|
||||
}));
|
||||
});
|
||||
|
||||
describe('Forgot password', () => {
|
||||
|
||||
it('should route user to forgot password component', async () => {
|
||||
spyOn(component, 'forgotPassword').and.callThrough();
|
||||
spyOn(router, 'navigate');
|
||||
|
||||
const forgotPasswordLink = fixture.debugElement.nativeElement.querySelector('.adf-login-forgot-password-link');
|
||||
forgotPasswordLink.dispatchEvent(new Event('click'));
|
||||
|
||||
expect(component.forgotPassword).toHaveBeenCalled();
|
||||
expect(router.navigate).toHaveBeenCalledWith(['./forgot-password']);
|
||||
});
|
||||
});
|
||||
|
||||
it('should render Login form with all the keys to be translated', () => {
|
||||
expect(element.querySelector('[for="username"]')).toBeDefined();
|
||||
expect(element.querySelector('[for="username"]').innerText).toEqual('LOGIN.LABEL.USERNAME');
|
||||
|
||||
@@ -68,6 +68,10 @@ export class LoginComponent implements OnInit, OnDestroy {
|
||||
@Input()
|
||||
showRememberMe: boolean = true;
|
||||
|
||||
/** Should the Forgot Password link be shown? */
|
||||
@Input()
|
||||
showForgotPassword: boolean = true;
|
||||
|
||||
/** Should the extra actions (`Need Help`, `Register`, etc) be shown? */
|
||||
@Input()
|
||||
showLoginActions: boolean = true;
|
||||
@@ -188,6 +192,14 @@ export class LoginComponent implements OnInit, OnDestroy {
|
||||
this.onSubmit(this.form.value);
|
||||
}
|
||||
|
||||
forgotPassword() {
|
||||
this.router.navigate(['./forgot-password']);
|
||||
}
|
||||
|
||||
isECMProvider() {
|
||||
return this.authService.isECMProvider();
|
||||
}
|
||||
|
||||
redirectToImplicitLogin() {
|
||||
this.alfrescoApiService.getInstance().oauth2Auth.implicitLogin();
|
||||
}
|
||||
|
||||
@@ -96,6 +96,13 @@
|
||||
--adf-theme-mat-grey-color-a200: mat.get-color-from-palette(mat.$grey-palette, A200),
|
||||
--adf-theme-mat-grey-color-a400: mat.get-color-from-palette(mat.$grey-palette, A400),
|
||||
--adf-theme-mat-grey-color-50: mat.get-color-from-palette(mat.$grey-palette, 50),
|
||||
--theme-forgot-password-background: #E5E5E5,
|
||||
--theme-forgot-password-title-color: #212121,
|
||||
--theme-forgot-password-label-color: rgba(33, 35, 40, 0.7),
|
||||
--theme-forgot-password-input-background-color: rgba(33, 33, 33, 0.05),
|
||||
--theme-forgot-password-button-background-color: #1f74db,
|
||||
--theme-forgot-password-dialog-border-color: rgba(33, 33, 33, 0.12),
|
||||
--theme-forgot-password-dialog-shadow-color: rgba(33, 35, 40, 0.06),
|
||||
|
||||
// spacing
|
||||
--adf-theme-spacing: map-get($custom-css-variables, 'theme-adf-spacing')
|
||||
|
||||
@@ -20,6 +20,7 @@ export * from './lib/viewer/index';
|
||||
export * from './lib/toolbar/index';
|
||||
export * from './lib/pagination/index';
|
||||
export * from './lib/login/index';
|
||||
export * from './lib/forgot-password/index';
|
||||
export * from './lib/language-menu/index';
|
||||
export * from './lib/info-drawer/index';
|
||||
export * from './lib/identity-user-info/index';
|
||||
|
||||
Reference in New Issue
Block a user