@annalib/anna-cognito-lib 0.2.3 → 0.2.4
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/.browserslistrc +16 -0
- package/README.md +2 -3
- package/karma.conf.js +44 -0
- package/ng-package.json +7 -0
- package/package.json +14 -37
- package/src/assets/.gitkeep +0 -0
- package/src/assets/images/Anna-Logo.png +0 -0
- package/src/lib/anna-cognito-lib.module.ts +51 -0
- package/src/lib/components/forgot-password/forgot-password.component.html +44 -0
- package/src/lib/components/forgot-password/forgot-password.component.scss +22 -0
- package/src/lib/components/forgot-password/forgot-password.component.spec.ts +25 -0
- package/src/lib/components/forgot-password/forgot-password.component.ts +75 -0
- package/src/lib/components/login/login.component.html +45 -0
- package/src/lib/components/login/login.component.scss +10 -0
- package/src/lib/components/login/login.component.spec.ts +25 -0
- package/src/lib/components/login/login.component.ts +47 -0
- package/src/lib/components/password-matching/password-matching.component.html +84 -0
- package/src/lib/components/password-matching/password-matching.component.scss +83 -0
- package/src/lib/components/password-matching/password-matching.component.spec.ts +25 -0
- package/src/lib/components/password-matching/password-matching.component.ts +92 -0
- package/src/lib/components/set-new-password/set-new-password.component.html +31 -0
- package/src/lib/components/set-new-password/set-new-password.component.scss +1 -0
- package/src/lib/components/set-new-password/set-new-password.component.spec.ts +25 -0
- package/src/lib/components/set-new-password/set-new-password.component.ts +54 -0
- package/src/lib/components/verify-and-set-new-password/verify-and-set-new-password.component.html +54 -0
- package/src/lib/components/verify-and-set-new-password/verify-and-set-new-password.component.scss +40 -0
- package/src/lib/components/verify-and-set-new-password/verify-and-set-new-password.component.spec.ts +25 -0
- package/src/lib/components/verify-and-set-new-password/verify-and-set-new-password.component.ts +70 -0
- package/src/lib/config/acl-service.token.ts +22 -0
- package/src/lib/config/auth-service.token.ts +15 -0
- package/src/lib/config/library.config.ts +8 -0
- package/src/lib/constants/loginConstant.ts +50 -0
- package/{lib/directives/spinner-button/index.d.ts → src/lib/directives/spinner-button/index.ts} +0 -0
- package/src/lib/directives/spinner-button/spinner-button.directive.spec.ts +40 -0
- package/src/lib/directives/spinner-button/spinner-button.directive.ts +36 -0
- package/src/lib/models/auth.model.ts +24 -0
- package/src/lib/scss/_colors.scss +107 -0
- package/src/lib/scss/_fonts.scss +86 -0
- package/src/lib/scss/_loginTemplate.scss +164 -0
- package/src/lib/services/acl.service.ts +24 -0
- package/src/lib/services/auth.service.ts +243 -0
- package/{public-api.d.ts → src/public-api.ts} +14 -0
- package/src/test.ts +27 -0
- package/tsconfig.lib.json +18 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
- package/annalib-anna-cognito-lib.d.ts +0 -5
- package/esm2020/annalib-anna-cognito-lib.mjs +0 -5
- package/esm2020/lib/anna-cognito-lib.module.mjs +0 -74
- package/esm2020/lib/components/forgot-password/forgot-password.component.mjs +0 -69
- package/esm2020/lib/components/login/login.component.mjs +0 -46
- package/esm2020/lib/components/password-matching/password-matching.component.mjs +0 -90
- package/esm2020/lib/components/set-new-password/set-new-password.component.mjs +0 -55
- package/esm2020/lib/components/verify-and-set-new-password/verify-and-set-new-password.component.mjs +0 -66
- package/esm2020/lib/config/acl-service.token.mjs +0 -4
- package/esm2020/lib/config/auth-service.token.mjs +0 -4
- package/esm2020/lib/config/library.config.mjs +0 -6
- package/esm2020/lib/constants/loginConstant.mjs +0 -46
- package/esm2020/lib/directives/spinner-button/index.mjs +0 -2
- package/esm2020/lib/directives/spinner-button/spinner-button.directive.mjs +0 -42
- package/esm2020/lib/models/auth.model.mjs +0 -18
- package/esm2020/lib/services/acl.service.mjs +0 -30
- package/esm2020/lib/services/auth.service.mjs +0 -218
- package/esm2020/public-api.mjs +0 -21
- package/fesm2015/annalib-anna-cognito-lib.mjs +0 -705
- package/fesm2015/annalib-anna-cognito-lib.mjs.map +0 -1
- package/fesm2020/annalib-anna-cognito-lib.mjs +0 -699
- package/fesm2020/annalib-anna-cognito-lib.mjs.map +0 -1
- package/lib/anna-cognito-lib.module.d.ts +0 -18
- package/lib/components/forgot-password/forgot-password.component.d.ts +0 -31
- package/lib/components/login/login.component.d.ts +0 -21
- package/lib/components/password-matching/password-matching.component.d.ts +0 -22
- package/lib/components/set-new-password/set-new-password.component.d.ts +0 -26
- package/lib/components/verify-and-set-new-password/verify-and-set-new-password.component.d.ts +0 -30
- package/lib/config/acl-service.token.d.ts +0 -19
- package/lib/config/auth-service.token.d.ts +0 -11
- package/lib/config/library.config.d.ts +0 -7
- package/lib/constants/loginConstant.d.ts +0 -40
- package/lib/directives/spinner-button/spinner-button.directive.d.ts +0 -15
- package/lib/models/auth.model.d.ts +0 -16
- package/lib/services/acl.service.d.ts +0 -12
- package/lib/services/auth.service.d.ts +0 -53
package/.browserslistrc
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
|
2
|
+
# For additional information regarding the format and rule options, please see:
|
|
3
|
+
# https://github.com/browserslist/browserslist#queries
|
|
4
|
+
|
|
5
|
+
# For the full list of supported browsers by the Angular framework, please see:
|
|
6
|
+
# https://angular.io/guide/browser-support
|
|
7
|
+
|
|
8
|
+
# You can see what browsers were selected by your queries by running:
|
|
9
|
+
# npx browserslist
|
|
10
|
+
|
|
11
|
+
last 1 Chrome version
|
|
12
|
+
last 1 Firefox version
|
|
13
|
+
last 2 Edge major versions
|
|
14
|
+
last 2 Safari major versions
|
|
15
|
+
last 2 iOS major versions
|
|
16
|
+
Firefox ESR
|
package/README.md
CHANGED
|
@@ -19,9 +19,8 @@ If using the library locally (library from your system locally not npm),then in
|
|
|
19
19
|
},
|
|
20
20
|
loginPageLogoImgUrl: ""
|
|
21
21
|
} ```
|
|
22
|
-
3.
|
|
23
|
-
|
|
24
|
-
Note: for better loading of logo image, provide logo image in minified format.
|
|
22
|
+
3. Keep the logo image in consuming project and provide the path for loginPageLogoImgUrl. ex: "assets/images/Anna-Logo.png"
|
|
23
|
+
Note: for better loading of logo image, provide logo image in minified format.
|
|
25
24
|
|
|
26
25
|
|
|
27
26
|
## Adding new custom function implemetation for any service file.
|
package/karma.conf.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Karma configuration file, see link for more information
|
|
2
|
+
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
3
|
+
|
|
4
|
+
module.exports = function (config) {
|
|
5
|
+
config.set({
|
|
6
|
+
basePath: '',
|
|
7
|
+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
|
8
|
+
plugins: [
|
|
9
|
+
require('karma-jasmine'),
|
|
10
|
+
require('karma-chrome-launcher'),
|
|
11
|
+
require('karma-jasmine-html-reporter'),
|
|
12
|
+
require('karma-coverage'),
|
|
13
|
+
require('@angular-devkit/build-angular/plugins/karma')
|
|
14
|
+
],
|
|
15
|
+
client: {
|
|
16
|
+
jasmine: {
|
|
17
|
+
// you can add configuration options for Jasmine here
|
|
18
|
+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
|
19
|
+
// for example, you can disable the random execution with `random: false`
|
|
20
|
+
// or set a specific seed with `seed: 4321`
|
|
21
|
+
},
|
|
22
|
+
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
23
|
+
},
|
|
24
|
+
jasmineHtmlReporter: {
|
|
25
|
+
suppressAll: true // removes the duplicated traces
|
|
26
|
+
},
|
|
27
|
+
coverageReporter: {
|
|
28
|
+
dir: require('path').join(__dirname, '../../coverage/anna-cognito-lib'),
|
|
29
|
+
subdir: '.',
|
|
30
|
+
reporters: [
|
|
31
|
+
{ type: 'html' },
|
|
32
|
+
{ type: 'text-summary' }
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
reporters: ['progress', 'kjhtml'],
|
|
36
|
+
port: 9876,
|
|
37
|
+
colors: true,
|
|
38
|
+
logLevel: config.LOG_INFO,
|
|
39
|
+
autoWatch: true,
|
|
40
|
+
browsers: ['Chrome'],
|
|
41
|
+
singleRun: false,
|
|
42
|
+
restartOnFileChange: true
|
|
43
|
+
});
|
|
44
|
+
};
|
package/ng-package.json
ADDED
package/package.json
CHANGED
|
@@ -1,37 +1,14 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@annalib/anna-cognito-lib",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"peerDependencies": {
|
|
5
|
-
"@angular/common": "^13.2.0",
|
|
6
|
-
"@angular/core": "^13.2.0",
|
|
7
|
-
"@mdi/font": "^5.1.45",
|
|
8
|
-
"@ng-bootstrap/ng-bootstrap": "^9.0.1",
|
|
9
|
-
"@types/node": "^12.11.1",
|
|
10
|
-
"amazon-cognito-identity-js": "^4.5.3",
|
|
11
|
-
"bootstrap": "^4.3.1",
|
|
12
|
-
"ngx-toastr": "^13.2.1"
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
"es2020": "fesm2020/annalib-anna-cognito-lib.mjs",
|
|
16
|
-
"esm2020": "esm2020/annalib-anna-cognito-lib.mjs",
|
|
17
|
-
"fesm2020": "fesm2020/annalib-anna-cognito-lib.mjs",
|
|
18
|
-
"fesm2015": "fesm2015/annalib-anna-cognito-lib.mjs",
|
|
19
|
-
"typings": "annalib-anna-cognito-lib.d.ts",
|
|
20
|
-
"exports": {
|
|
21
|
-
"./package.json": {
|
|
22
|
-
"default": "./package.json"
|
|
23
|
-
},
|
|
24
|
-
".": {
|
|
25
|
-
"types": "./annalib-anna-cognito-lib.d.ts",
|
|
26
|
-
"esm2020": "./esm2020/annalib-anna-cognito-lib.mjs",
|
|
27
|
-
"es2020": "./fesm2020/annalib-anna-cognito-lib.mjs",
|
|
28
|
-
"es2015": "./fesm2015/annalib-anna-cognito-lib.mjs",
|
|
29
|
-
"node": "./fesm2015/annalib-anna-cognito-lib.mjs",
|
|
30
|
-
"default": "./fesm2020/annalib-anna-cognito-lib.mjs"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"sideEffects": false,
|
|
34
|
-
"dependencies": {
|
|
35
|
-
"tslib": "^2.3.0"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@annalib/anna-cognito-lib",
|
|
3
|
+
"version": "0.2.4",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^13.2.0",
|
|
6
|
+
"@angular/core": "^13.2.0",
|
|
7
|
+
"@mdi/font": "^5.1.45",
|
|
8
|
+
"@ng-bootstrap/ng-bootstrap": "^9.0.1",
|
|
9
|
+
"@types/node": "^12.11.1",
|
|
10
|
+
"amazon-cognito-identity-js": "^4.5.3",
|
|
11
|
+
"bootstrap": "^4.3.1",
|
|
12
|
+
"ngx-toastr": "^13.2.1"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
File without changes
|
|
Binary file
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ModuleWithProviders, NgModule } from '@angular/core';
|
|
2
|
+
import { LoginComponent } from './components/login/login.component';
|
|
3
|
+
import { SpinnerButtonDirective } from './directives/spinner-button';
|
|
4
|
+
import { LibraryConfig } from './config/library.config';
|
|
5
|
+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
6
|
+
import { RouterModule } from '@angular/router';
|
|
7
|
+
import { CommonModule } from '@angular/common';
|
|
8
|
+
import { SetNewPasswordComponent } from './components/set-new-password/set-new-password.component';
|
|
9
|
+
import { PasswordMatchingComponent } from './components/password-matching/password-matching.component';
|
|
10
|
+
import { ForgotPasswordComponent } from './components/forgot-password/forgot-password.component';
|
|
11
|
+
import { VerifyAndSetNewPasswordComponent } from './components/verify-and-set-new-password/verify-and-set-new-password.component';
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@NgModule({
|
|
16
|
+
declarations: [
|
|
17
|
+
LoginComponent,
|
|
18
|
+
SetNewPasswordComponent,
|
|
19
|
+
PasswordMatchingComponent,
|
|
20
|
+
ForgotPasswordComponent,
|
|
21
|
+
VerifyAndSetNewPasswordComponent,
|
|
22
|
+
SpinnerButtonDirective,
|
|
23
|
+
],
|
|
24
|
+
imports: [
|
|
25
|
+
FormsModule,
|
|
26
|
+
ReactiveFormsModule,
|
|
27
|
+
RouterModule,
|
|
28
|
+
CommonModule
|
|
29
|
+
],
|
|
30
|
+
exports: [
|
|
31
|
+
LoginComponent,
|
|
32
|
+
SetNewPasswordComponent,
|
|
33
|
+
PasswordMatchingComponent,
|
|
34
|
+
ForgotPasswordComponent,
|
|
35
|
+
VerifyAndSetNewPasswordComponent,
|
|
36
|
+
SpinnerButtonDirective
|
|
37
|
+
]
|
|
38
|
+
})
|
|
39
|
+
export class AnnaCognitoLibModule {
|
|
40
|
+
public static forRoot(configuration: LibraryConfig): ModuleWithProviders<AnnaCognitoLibModule> {
|
|
41
|
+
return {
|
|
42
|
+
ngModule: AnnaCognitoLibModule,
|
|
43
|
+
providers: [
|
|
44
|
+
{
|
|
45
|
+
provide: LibraryConfig,
|
|
46
|
+
useValue: configuration
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<div class="main">
|
|
2
|
+
<section>
|
|
3
|
+
<header>
|
|
4
|
+
<img src="assets/images/Anna-Logo-for-footer-min.png" alt="Anna Logo" />
|
|
5
|
+
</header>
|
|
6
|
+
<article>
|
|
7
|
+
<form [formGroup]="verifyRegisteredEmail">
|
|
8
|
+
<div id="heading">
|
|
9
|
+
{{ constants.forgotPasswordHeading }}
|
|
10
|
+
</div>
|
|
11
|
+
<p>
|
|
12
|
+
{{ constants.forgotPasswordMessage }}
|
|
13
|
+
</p>
|
|
14
|
+
<div id="alert-div" *ngIf="errorMessage">
|
|
15
|
+
<span class="material-icons">report</span>
|
|
16
|
+
<p id="alert-msg">{{ errorMessage }}</p>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<input
|
|
20
|
+
type="text"
|
|
21
|
+
tabindex="1"
|
|
22
|
+
formControlName="email"
|
|
23
|
+
[placeholder]="constants.enterEmail"
|
|
24
|
+
[ngClass]="{
|
|
25
|
+
'input-invalid': verifyRegisteredEmail.get('email')?.dirty && verifyRegisteredEmail.get('email')?.errors
|
|
26
|
+
}"
|
|
27
|
+
/>
|
|
28
|
+
|
|
29
|
+
<button
|
|
30
|
+
tabindex="2"
|
|
31
|
+
type="submit"
|
|
32
|
+
class="login-btn"
|
|
33
|
+
[disabled]="!isFormValid()"
|
|
34
|
+
(click)="onVerifyRegisteredEmail()"
|
|
35
|
+
>
|
|
36
|
+
{{ constants.forgotPasswordButton }}
|
|
37
|
+
</button>
|
|
38
|
+
</form>
|
|
39
|
+
</article>
|
|
40
|
+
<footer>
|
|
41
|
+
Powered by <span> <strong> SureWaves</strong></span>
|
|
42
|
+
</footer>
|
|
43
|
+
</section>
|
|
44
|
+
</div>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@import "../../scss/loginTemplate", "../../scss/fonts", "../../scss/colors";
|
|
2
|
+
p {
|
|
3
|
+
color: $charcoal;
|
|
4
|
+
@include fonts(Roboto, 1rem, normal, normal, normal, normal, normal);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
input[type="text"] {
|
|
8
|
+
margin-bottom: 16px;
|
|
9
|
+
&:focus {
|
|
10
|
+
box-shadow: none;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.back-btn {
|
|
15
|
+
font-size: 27px;
|
|
16
|
+
position: relative;
|
|
17
|
+
color: #268bff;
|
|
18
|
+
float: left;
|
|
19
|
+
top: -30px;
|
|
20
|
+
left: -15px;
|
|
21
|
+
font-weight: normal !important;
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ForgotPasswordComponent } from './forgot-password.component';
|
|
4
|
+
|
|
5
|
+
describe('ForgotPasswordComponent', () => {
|
|
6
|
+
let component: ForgotPasswordComponent;
|
|
7
|
+
let fixture: ComponentFixture<ForgotPasswordComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ ForgotPasswordComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(ForgotPasswordComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Angular import statements
|
|
2
|
+
import { Component, OnInit } from "@angular/core";
|
|
3
|
+
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
|
4
|
+
|
|
5
|
+
// Third party import statements
|
|
6
|
+
import { ToastrService } from "ngx-toastr";
|
|
7
|
+
|
|
8
|
+
// User defined import statements
|
|
9
|
+
import { UsernameInfo } from "../../models/auth.model";
|
|
10
|
+
import { AnnaLibAuthService } from "../../services/auth.service";
|
|
11
|
+
import { LoginConstant } from "../../constants/loginConstant";
|
|
12
|
+
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'anna-cognito-lib-forgot-password',
|
|
15
|
+
templateUrl: './forgot-password.component.html',
|
|
16
|
+
styleUrls: ['./forgot-password.component.scss']
|
|
17
|
+
})
|
|
18
|
+
export class ForgotPasswordComponent implements OnInit {
|
|
19
|
+
errorMessage: string;
|
|
20
|
+
verifyRegisteredEmail: FormGroup;
|
|
21
|
+
passwordNotMatching = false;
|
|
22
|
+
constants: typeof LoginConstant;
|
|
23
|
+
password = { value: null, status: null };
|
|
24
|
+
confirmPassword = { value: null, status: null };
|
|
25
|
+
|
|
26
|
+
constructor(
|
|
27
|
+
private authService: AnnaLibAuthService,
|
|
28
|
+
private fb: FormBuilder,
|
|
29
|
+
private toastr: ToastrService
|
|
30
|
+
) {}
|
|
31
|
+
|
|
32
|
+
ngOnInit() {
|
|
33
|
+
this.constants = LoginConstant;
|
|
34
|
+
this.onIntialiseForm();
|
|
35
|
+
if (this.authService.userName) {
|
|
36
|
+
this.onUpdateForm();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
onIntialiseForm() {
|
|
41
|
+
this.verifyRegisteredEmail = this.fb.group({
|
|
42
|
+
email: [null, [Validators.required]],
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
onUpdateForm() {
|
|
47
|
+
this.verifyRegisteredEmail.patchValue({
|
|
48
|
+
email: this.authService.userName,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
isFormValid() {
|
|
53
|
+
return this.verifyRegisteredEmail.valid;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
onVerifyRegisteredEmail() {
|
|
57
|
+
let username = this.verifyRegisteredEmail.controls['email'].value;
|
|
58
|
+
this.authService.consumingProjectAuthService.isUsernameAvailable(username)
|
|
59
|
+
.subscribe(
|
|
60
|
+
{
|
|
61
|
+
next: (response) => {
|
|
62
|
+
let res = new UsernameInfo(response);
|
|
63
|
+
if (!res.isUsernameAvailable) {
|
|
64
|
+
this.authService.onForgotPasswordGenerateOTP(username);
|
|
65
|
+
} else {
|
|
66
|
+
this.errorMessage = this.constants.userNotFound;
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
error: any => {
|
|
70
|
+
this.toastr.error(LoginConstant.apiFailErrorMessage);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<div class="main">
|
|
2
|
+
<!-- Load login page when all constant variable are intiated otherwise it will show a glitch. that's why ngIf check of constants.forgotPassword -->
|
|
3
|
+
<section *ngIf="constants.forgotPassword">
|
|
4
|
+
<header>
|
|
5
|
+
<img [src]="libraryConfig.loginPageLogoImgUrl" loading="eager" alt="Anna Logo" />
|
|
6
|
+
</header>
|
|
7
|
+
<article>
|
|
8
|
+
<form [formGroup]="loginForm" (ngSubmit)="OnLogin()">
|
|
9
|
+
<div id="alert-div" *ngIf="authService.loginErrorMessage">
|
|
10
|
+
<span class="material-icons">report</span>
|
|
11
|
+
<p>{{ authService.loginErrorMessage }}</p>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<input
|
|
15
|
+
type="text"
|
|
16
|
+
tabindex="1"
|
|
17
|
+
formControlName="username"
|
|
18
|
+
[ngClass]="{ 'input-invalid': authService.loginErrorMessage }"
|
|
19
|
+
[placeholder]="constants.enterEmail"
|
|
20
|
+
autocomplete="username"
|
|
21
|
+
autofocus
|
|
22
|
+
/>
|
|
23
|
+
|
|
24
|
+
<input
|
|
25
|
+
type="password"
|
|
26
|
+
tabindex="2"
|
|
27
|
+
formControlName="password"
|
|
28
|
+
[ngClass]="{ 'input-invalid': authService.loginErrorMessage }"
|
|
29
|
+
[placeholder]="constants.password"
|
|
30
|
+
autocomplete="current-password"
|
|
31
|
+
autofocus
|
|
32
|
+
/>
|
|
33
|
+
|
|
34
|
+
<a tabindex="4" [routerLink]="constants.forgortPasswordPageUrl">{{ constants.forgotPassword }}</a>
|
|
35
|
+
<button
|
|
36
|
+
tabindex="3"
|
|
37
|
+
class="login-btn"
|
|
38
|
+
[anna-cognito-lib-SpinnerButton]="authService.consumingProjectAuthService.isLoggingIn"
|
|
39
|
+
[spinnerButtonText]="constants.login"
|
|
40
|
+
></button>
|
|
41
|
+
</form>
|
|
42
|
+
</article>
|
|
43
|
+
<footer>Powered by <span>SureWaves</span></footer>
|
|
44
|
+
</section>
|
|
45
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { LoginComponent } from './login.component';
|
|
4
|
+
|
|
5
|
+
describe('LoginComponent', () => {
|
|
6
|
+
let component: LoginComponent;
|
|
7
|
+
let fixture: ComponentFixture<LoginComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ LoginComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(LoginComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Angular import statements
|
|
2
|
+
import { Component, OnInit } from "@angular/core";
|
|
3
|
+
import { FormBuilder, FormGroup } from "@angular/forms";
|
|
4
|
+
|
|
5
|
+
// User defined import statements
|
|
6
|
+
import { LoginConstant } from "../../constants/loginConstant";
|
|
7
|
+
import { AnnaLibAuthService } from '../../services/auth.service';
|
|
8
|
+
import { LibraryConfig } from '../../config/library.config';
|
|
9
|
+
|
|
10
|
+
@Component({
|
|
11
|
+
selector: "anna-cognito-lib-login",
|
|
12
|
+
templateUrl: "./login.component.html",
|
|
13
|
+
styleUrls: ["./login.component.scss"],
|
|
14
|
+
})
|
|
15
|
+
export class LoginComponent implements OnInit {
|
|
16
|
+
loginForm: FormGroup;
|
|
17
|
+
constants: typeof LoginConstant;
|
|
18
|
+
annaLogoUrl: string = "assets/images/Anna-Logo-for-footer-min.png";
|
|
19
|
+
logoUrl: string;
|
|
20
|
+
|
|
21
|
+
constructor(
|
|
22
|
+
public authService: AnnaLibAuthService,
|
|
23
|
+
private fb: FormBuilder,
|
|
24
|
+
public libraryConfig: LibraryConfig
|
|
25
|
+
) {}
|
|
26
|
+
|
|
27
|
+
ngOnInit() {
|
|
28
|
+
this.constants = LoginConstant;
|
|
29
|
+
this.onIntialiseForm();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
onIntialiseForm() {
|
|
33
|
+
this.loginForm = this.fb.group({
|
|
34
|
+
username: [null],
|
|
35
|
+
password: [null],
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
OnLogin() {
|
|
40
|
+
this.authService.consumingProjectAuthService.isLoggingIn = true;
|
|
41
|
+
const username = this.loginForm.controls['username'].value;
|
|
42
|
+
const password = this.loginForm.controls['password'].value;
|
|
43
|
+
this.authService.authenticate(username, password);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<form [formGroup]="passwordForm">
|
|
2
|
+
<div id="alert-div" *ngIf="passwordNotMatching">
|
|
3
|
+
<div id="icon-div">
|
|
4
|
+
<span class="material-icons">report</span>
|
|
5
|
+
</div>
|
|
6
|
+
<p>{{ constants.passwordNotMatching }}</p>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="password-policies">
|
|
9
|
+
<ng-container *ngIf="!passwordForm.get('password')?.dirty">
|
|
10
|
+
<p>
|
|
11
|
+
<b>{{ constants.passwordMustContain }} </b>
|
|
12
|
+
</p>
|
|
13
|
+
<p>{{ constants.minimumCharacter }}</p>
|
|
14
|
+
<p>{{ constants.oneUppercase }}</p>
|
|
15
|
+
<p>{{ constants.oneLowercase }}</p>
|
|
16
|
+
<p>{{ constants.oneNumber }}</p>
|
|
17
|
+
<p>{{ constants.specialCharacter }}</p>
|
|
18
|
+
</ng-container>
|
|
19
|
+
|
|
20
|
+
<ng-container *ngIf="passwordForm.get('password')?.dirty">
|
|
21
|
+
<p>
|
|
22
|
+
<b>{{ constants.passwordMustContain }}</b>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
<div [ngClass]="passwordForm.get('password')?.hasError('minLength') ? 'error-color' : 'success-color'">
|
|
26
|
+
<div id="icon-div-msg">
|
|
27
|
+
<span class="material-icons" *ngIf="passwordForm.get('password')?.hasError('minLength')"> cancel </span>
|
|
28
|
+
<span class="material-icons" *ngIf="!passwordForm.get('password')?.hasError('minLength')"> check_circle </span>
|
|
29
|
+
</div>
|
|
30
|
+
<span class="span-text">{{ constants.minimumCharacter }}</span>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<div [ngClass]="passwordForm.get('password')?.hasError('uppercase') ? 'error-color' : 'success-color'">
|
|
34
|
+
<div id="icon-div-msg">
|
|
35
|
+
<span class="material-icons" *ngIf="passwordForm.get('password')?.hasError('uppercase')"> cancel </span>
|
|
36
|
+
<span class="material-icons" *ngIf="!passwordForm.get('password')?.hasError('uppercase')"> check_circle </span>
|
|
37
|
+
</div>
|
|
38
|
+
<span class="span-text">{{ constants.oneUppercase }}</span>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div [ngClass]="passwordForm.get('password')?.hasError('lowercase') ? 'error-color' : 'success-color'">
|
|
42
|
+
<div id="icon-div-msg">
|
|
43
|
+
<span class="material-icons" *ngIf="passwordForm.get('password')?.hasError('lowercase')"> cancel </span>
|
|
44
|
+
<span class="material-icons" *ngIf="!passwordForm.get('password')?.hasError('lowercase')"> check_circle </span>
|
|
45
|
+
</div>
|
|
46
|
+
<span class="span-text">{{ constants.oneLowercase }}</span>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div [ngClass]="passwordForm.get('password')?.hasError('number') ? 'error-color' : 'success-color'">
|
|
50
|
+
<div id="icon-div-msg">
|
|
51
|
+
<span class="material-icons" *ngIf="passwordForm.get('password')?.hasError('number')"> cancel </span>
|
|
52
|
+
<span class="material-icons" *ngIf="!passwordForm.get('password')?.hasError('number')"> check_circle </span>
|
|
53
|
+
</div>
|
|
54
|
+
<span class="span-text">{{ constants.oneNumber }}</span>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div [ngClass]="passwordForm.get('password')?.hasError('specialCharacter') ? 'error-color' : 'success-color'">
|
|
58
|
+
<div id="icon-div-msg">
|
|
59
|
+
<span class="material-icons" *ngIf="passwordForm.get('password')?.hasError('specialCharacter')"> cancel </span>
|
|
60
|
+
<span class="material-icons" *ngIf="!passwordForm.get('password')?.hasError('specialCharacter')">
|
|
61
|
+
check_circle
|
|
62
|
+
</span>
|
|
63
|
+
</div>
|
|
64
|
+
<span class="span-text">{{ constants.specialCharacter }}</span>
|
|
65
|
+
</div>
|
|
66
|
+
</ng-container>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<input
|
|
70
|
+
type="password"
|
|
71
|
+
tabindex="2"
|
|
72
|
+
formControlName="password"
|
|
73
|
+
[placeholder]="constants.password"
|
|
74
|
+
[ngClass]="{ 'input-invalid': passwordNotMatching }"
|
|
75
|
+
/>
|
|
76
|
+
|
|
77
|
+
<input
|
|
78
|
+
type="password"
|
|
79
|
+
tabindex="3"
|
|
80
|
+
formControlName="confirmPassword"
|
|
81
|
+
[placeholder]="constants.confirmPassword"
|
|
82
|
+
[ngClass]="{ 'input-invalid': passwordNotMatching }"
|
|
83
|
+
/>
|
|
84
|
+
</form>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
@import "../../scss/colors", "../../scss/fonts";
|
|
2
|
+
input[type="password"],
|
|
3
|
+
input[type="text"] {
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 30px;
|
|
6
|
+
padding: 10px 16px;
|
|
7
|
+
border: 1px solid $gray;
|
|
8
|
+
margin-bottom: 0.625rem;
|
|
9
|
+
border-radius: 0.375rem;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
input[type="password"].ng-dirty.ng-invalid,
|
|
13
|
+
.input-invalid {
|
|
14
|
+
border: 1px solid $redOrange4 !important;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
input[type="password"]:focus {
|
|
18
|
+
&:focus {
|
|
19
|
+
outline: none;
|
|
20
|
+
box-shadow: none;
|
|
21
|
+
}
|
|
22
|
+
&::placeholder {
|
|
23
|
+
color: $darkGray2;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.password-policies {
|
|
28
|
+
margin-bottom: 1rem;
|
|
29
|
+
& p {
|
|
30
|
+
color: $charcoal;
|
|
31
|
+
@include fonts(Roboto, 1rem, normal, normal, normal, 1.31, normal);
|
|
32
|
+
margin-bottom: 0;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.span-text {
|
|
37
|
+
vertical-align: top;
|
|
38
|
+
@include fonts(Roboto, 1rem, normal, normal, normal, 1.31, normal);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
#icon-div-msg {
|
|
42
|
+
display: inline;
|
|
43
|
+
margin-right: 0.3125rem;
|
|
44
|
+
& .material-icons {
|
|
45
|
+
margin-top: 1px;
|
|
46
|
+
font-size: 16px;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#alert-div {
|
|
51
|
+
padding: 4px 0 0 0;
|
|
52
|
+
margin-bottom: 0.75rem;
|
|
53
|
+
border-radius: 0.25rem;
|
|
54
|
+
border: solid 1px $roseBud;
|
|
55
|
+
background-color: $paleRed;
|
|
56
|
+
|
|
57
|
+
& #icon-div {
|
|
58
|
+
width: 18px;
|
|
59
|
+
margin-top: -5px;
|
|
60
|
+
display: inline-block;
|
|
61
|
+
& .material-icons {
|
|
62
|
+
color: $redOrange3;
|
|
63
|
+
font-size: 1.125rem;
|
|
64
|
+
margin-left: 0.5rem;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
& p {
|
|
69
|
+
display: inline;
|
|
70
|
+
vertical-align: top;
|
|
71
|
+
margin-left: 0.5rem;
|
|
72
|
+
color: $charcoal;
|
|
73
|
+
@include fonts(Roboto, 0.7188rem, normal, normal, normal, normal, normal);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.error-color {
|
|
78
|
+
color: $redOrange4;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.success-color {
|
|
82
|
+
color: $fruitSalad;
|
|
83
|
+
}
|