Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ba66f7b

Browse filesBrowse files
committed
Merge branch 'master' of github.com:aviabird/angularspree into migrate_to_ngrx_store_4
2 parents 69ba496 + 1ec718d commit ba66f7b
Copy full SHA for ba66f7b

3 files changed

+37-10Lines changed: 37 additions & 10 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/app/auth/components/sign-up/sign-up.component.html‎

Copy file name to clipboardExpand all lines: src/app/auth/components/sign-up/sign-up.component.html
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ <h3 class="panel-title">Signup to {{title}}</h3>
4343
<div class="register-input-item">
4444
<input type="password" class="register-user-input-password register-user-input" name="password_confirmation" formControlName="password_confirmation"
4545
placeholder="Confirm Password" autocomplete="off">
46-
<div *ngIf="signUpForm.get('password_confirmation').errors && signUpForm.get('password_confirmation').touched">
46+
<div *ngIf="(signUpForm.get('password_confirmation').errors || signUpForm.hasError('mismatchedPasswords')) && signUpForm.get('password_confirmation').touched">
4747
<span class="register-error-icon">!</span>
48-
<p class="register-error-message">{{signUpForm.get('password_confirmation').errors.msg || 'Password must match'}}</p>
48+
<p class="register-error-message">{{ 'Password must match'}}</p>
4949
</div>
5050
</div>
5151

5252
<div class="register-input-item">
53-
<input type="number" min="1000000000" max="9999999999" class="register-user-input-mobile register-user-input" name="mobile"
53+
<input type="number" class="register-user-input-mobile register-user-input" name="mobile"
5454
formControlName="mobile" placeholder="Mobile Number (For order status updates)">
5555
<div *ngIf="signUpForm.get('mobile').errors && signUpForm.get('mobile').touched">
5656
<span class="register-error-icon">!</span>
Collapse file

‎src/app/auth/components/sign-up/sign-up.component.scss‎

Copy file name to clipboardExpand all lines: src/app/auth/components/sign-up/sign-up.component.scss
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,16 @@ a {
218218
[type=button], [type=reset], [type=submit], button {
219219
cursor: pointer;
220220
}
221+
/* For Firefox */
222+
input[type='number'] {
223+
-moz-appearance:textfield;
224+
}
225+
/* Webkit browsers like Safari and Chrome */
226+
input[type=number]::-webkit-inner-spin-button,
227+
input[type=number]::-webkit-outer-spin-button {
228+
-webkit-appearance: none;
229+
margin: 0;
230+
}
221231

222232
button, select {
223233
text-transform: none;
Collapse file

‎src/app/auth/components/sign-up/sign-up.component.ts‎

Copy file name to clipboardExpand all lines: src/app/auth/components/sign-up/sign-up.component.ts
+24-7Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,14 @@ export class SignUpComponent implements OnInit, OnDestroy {
6868
const mobile = '';
6969
const gender = '';
7070

71-
this.signUpForm = this.fb.group({
72-
'email': [email, Validators.required],
73-
'password': [password, Validators.required],
74-
'password_confirmation': [password_confirmation, Validators.required],
75-
'mobile': [mobile, Validators.required],
76-
'gender': [gender, Validators.required],
77-
});
71+
this.signUpForm = this.fb.group({
72+
'email': [email, Validators.compose([Validators.required, Validators.email]) ],
73+
'password': [password, Validators.compose([Validators.required, Validators.minLength(6)]) ],
74+
'password_confirmation': [password_confirmation, Validators.compose([Validators.required, Validators.minLength(6)]) ],
75+
'mobile': [mobile, Validators.compose([Validators.required, Validators.minLength(10), Validators.maxLength(10),Validators.pattern('[0-9]{10}')]) ],
76+
'gender': [gender, Validators.required]
77+
},{validator: this.matchingPasswords('password', 'password_confirmation')}
78+
);
7879
}
7980

8081
redirectIfUserLoggedIn() {
@@ -88,4 +89,20 @@ export class SignUpComponent implements OnInit, OnDestroy {
8889
ngOnDestroy() {
8990
if (this.registerSubs) { this.registerSubs.unsubscribe(); }
9091
}
92+
93+
matchingPasswords(passwordKey: string, confirmPasswordKey: string) {
94+
return (group: FormGroup): {[key: string]: any} => {
95+
let password = group.controls[passwordKey];
96+
let confirmPassword = group.controls[confirmPasswordKey];
97+
98+
if (password.value !== confirmPassword.value) {
99+
return {
100+
mismatchedPasswords: true
101+
};
102+
}
103+
}
104+
}
105+
106+
107+
91108
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.