diff --git a/lib/core/login/components/login.component.html b/lib/core/login/components/login.component.html index 6b2ab39b3e..ed420f8b72 100644 --- a/lib/core/login/components/login.component.html +++ b/lib/core/login/components/login.component.html @@ -92,6 +92,8 @@ data-automation-id="login-button" [disabled]="!form.valid" [attr.aria-label]="'LOGIN.BUTTON.LOGIN' | translate"> + + {{ 'LOGIN.BUTTON.LOGIN' | translate }}
{{ 'LOGIN.LABEL.REMEMBER' | translate }}
+
+
+ + Forgot Password? +
+
@@ -129,6 +137,7 @@
+ diff --git a/lib/core/login/components/login.component.ts b/lib/core/login/components/login.component.ts index 94d4d86a7f..d80bccf9e3 100644 --- a/lib/core/login/components/login.component.ts +++ b/lib/core/login/components/login.component.ts @@ -38,6 +38,8 @@ import { OauthConfigModel } from '../../models/oauth-config.model'; import { DomSanitizer, SafeStyle } from '@angular/platform-browser'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; +import { RecoverPasswordDialogService } from './recover-password-dialog.service'; +import { RecoverPasswordComponent } from './recover-password/recover-password.component'; // eslint-disable-next-line no-shadow enum LoginSteps { @@ -121,6 +123,7 @@ export class LoginComponent implements OnInit, OnDestroy { actualLoginStep: any = LoginSteps.Landing; LoginSteps = LoginSteps; rememberMe: boolean = true; + forgotPasswordStatus: boolean = true; formError: { [id: string]: string }; minLength: number = 2; footerTemplate: TemplateRef; @@ -140,7 +143,8 @@ export class LoginComponent implements OnInit, OnDestroy { private userPreferences: UserPreferencesService, private route: ActivatedRoute, private sanitizer: DomSanitizer, - private alfrescoApiService: AlfrescoApiService + private alfrescoApiService: AlfrescoApiService, + private dialogService: RecoverPasswordDialogService ) { } @@ -190,6 +194,21 @@ export class LoginComponent implements OnInit, OnDestroy { this.onSubmit(this.form.value); } + forgotPassword(){ + this.dialogService + .showDialog(RecoverPasswordComponent, { + data: { + title: 'Recover' + } + }) + .afterClosed() +// .subscribe((result) => { +// if (result) { + +// } +// }); + } + redirectToImplicitLogin() { this.alfrescoApiService.getInstance().oauth2Auth.implicitLogin(); } @@ -413,4 +432,6 @@ export class LoginComponent implements OnInit, OnDestroy { this.isError = false; this.initFormError(); } + + } diff --git a/lib/core/login/components/recover-password-dialog.service.ts b/lib/core/login/components/recover-password-dialog.service.ts new file mode 100644 index 0000000000..92a83f70aa --- /dev/null +++ b/lib/core/login/components/recover-password-dialog.service.ts @@ -0,0 +1,24 @@ +/* + * Copyright © 2005 - 2021 Alfresco Software, Ltd. All rights reserved. + * + * License rights for this program may be obtained from Alfresco Software, Ltd. + * pursuant to a written agreement and any use of this program without such an + * agreement is prohibited. + */ + +import { Injectable, TemplateRef } from '@angular/core'; +import { MatDialog, MatDialogRef } from '@angular/material/dialog'; +import { ComponentType } from '@angular/cdk/portal'; + +@Injectable({ providedIn: 'root' }) +export class RecoverPasswordDialogService { + constructor(private dialog: MatDialog) { } + + showDialog(dialog: ComponentType | TemplateRef, options = {}): MatDialogRef { + return this.dialog.open(dialog, { + height: '35%', + minWidth: '30%', + ...options + }); + } +} diff --git a/lib/core/login/components/recover-password/recover-password.component.html b/lib/core/login/components/recover-password/recover-password.component.html new file mode 100644 index 0000000000..058cf3a47f --- /dev/null +++ b/lib/core/login/components/recover-password/recover-password.component.html @@ -0,0 +1,87 @@ + + +
+
+
+
Recover Password
+
+
+ +
+ +

Don't Worry, happens to the best of us.

+ + + +
+
+ + + + + + + Field Required* + + Enter Valid Email Address + + +
+ +
+
+ + + +
+ + +
+ + + +
+ + + +
+ + + \ No newline at end of file diff --git a/lib/core/login/components/recover-password/recover-password.component.scss b/lib/core/login/components/recover-password/recover-password.component.scss new file mode 100644 index 0000000000..7c9fb6c0c7 --- /dev/null +++ b/lib/core/login/components/recover-password/recover-password.component.scss @@ -0,0 +1,48 @@ +.aaa { + &-dialog { + display: flex; + flex-direction: column; + height: 50%; + &-body { + flex: 1; + overflow-y: auto; + padding: 0 15px; + } + &-footer { + display: flex; + justify-content: flex-end; + align-self: flex-end; + } + } + &-security-controls { + + &-actions { + padding: 15px 10px; + } + &-toggle-description-text { + color: var(--theme-accent-color); + font-weight: bold; + cursor: pointer; + } + &-config-type-image-container { + display: flex; + width: 100%; + flex-direction: row; + justify-content: center; + } + &-config-type-image { + width: 100%; + } + } +} + + +.aaa-dialog{ + width: 100%; + height: 100%; +} + +// mat-dialog-container{ +// border: 1px solid black; +// border-radius: 50px; +// } diff --git a/lib/core/login/components/recover-password/recover-password.component.spec.ts b/lib/core/login/components/recover-password/recover-password.component.spec.ts new file mode 100644 index 0000000000..e38734c1ad --- /dev/null +++ b/lib/core/login/components/recover-password/recover-password.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { RecoverPasswordComponent } from './recover-password.component'; + +describe('RecoverPasswordComponent', () => { + let component: RecoverPasswordComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ RecoverPasswordComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(RecoverPasswordComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/lib/core/login/components/recover-password/recover-password.component.ts b/lib/core/login/components/recover-password/recover-password.component.ts new file mode 100644 index 0000000000..b5a1ea867f --- /dev/null +++ b/lib/core/login/components/recover-password/recover-password.component.ts @@ -0,0 +1,86 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 Alfresco Software Limited + * + * 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 + * along with Alfresco. If not, see . + */ + +//import { AlfrescoApiService, AppConfigService, AuthenticationService, CardViewArrayItemModel, CardViewBoolItemModel, CardViewDateItemModel, CardViewDatetimeItemModel, CardViewFloatItemModel, CardViewIntItemModel, CardViewKeyValuePairsItemModel, CardViewMapItemModel, CardViewSelectItemModel, CardViewTextItemModel, LogService, TranslationService, UserPreferencesService } from '@alfresco/adf-core'; +import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +//import { MatDialogRef } from '@angular/material/dialog'; +// import { FormBuilder } from '@angular/forms'; +// import { DomSanitizer } from '@angular/platform-browser'; +// import { ActivatedRoute, Router } from '@angular/router'; +// import { of } from 'rxjs'; + +@Component({ + selector: 'aaa-recover-password', + templateUrl: './recover-password.component.html', + styleUrls: ['./recover-password.component.scss'] +}) +export class RecoverPasswordComponent implements OnInit{ + + recoverPasswordForm: FormGroup; + saveInProgress : boolean = false; + passwordResetStatus : boolean = false; + properties = [{label: 'My Label', value: 'My value'}]; + + + @ViewChild('DialogBodyContainer') dialogBodyContainer: ElementRef; + + + + constructor(private formBuilder: FormBuilder, + //private matDialogRef: MatDialogRef, + //@Inject(MAT_DIALOG_DATA) private data: any + ) { } + + + + ngOnInit(): void { + + this.recoverPasswordForm = this.formBuilder.group({ + emailId:['',[Validators.required, Validators.pattern('^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9.-]{2,}$')]] + }) + } + + + + sendInstructions() { + this.saveInProgress = true; + console.log("Sending Email to ", this.recoverPasswordForm.controls.emailId.value); + this.passwordResetStatus = true; + //this.matDialogRef.close(); + } + + + + isSaveDisabled(): boolean { + return !this.recoverPasswordForm.valid || this.saveInProgress; + } + + + + + + +} \ No newline at end of file diff --git a/lib/core/login/login.module.ts b/lib/core/login/login.module.ts index 742f42f19a..673063f7a0 100644 --- a/lib/core/login/login.module.ts +++ b/lib/core/login/login.module.ts @@ -27,6 +27,7 @@ import { LoginFooterDirective } from './directives/login-footer.directive'; import { LoginHeaderDirective } from './directives/login-header.directive'; import { LoginDialogComponent } from './components/login-dialog.component'; import { LoginDialogPanelComponent } from './components/login-dialog-panel.component'; +import { RecoverPasswordComponent } from './components/recover-password/recover-password.component'; @NgModule({ imports: [ @@ -42,7 +43,8 @@ import { LoginDialogPanelComponent } from './components/login-dialog-panel.compo LoginFooterDirective, LoginHeaderDirective, LoginDialogComponent, - LoginDialogPanelComponent + LoginDialogPanelComponent, + RecoverPasswordComponent ], exports: [ LoginComponent,