signup ing

This commit is contained in:
insanity 2018-04-10 16:30:05 +09:00
parent 5aed772c54
commit 5809b605b1
5 changed files with 59 additions and 46 deletions

View File

@ -29,8 +29,6 @@
<span class="ui-button-icon-left ui-c fa fa-fw ui-icon-help"></span> <span class="ui-button-icon-left ui-c fa fa-fw ui-icon-help"></span>
<span class="ui-button-text ui-c">Sign Up</span> <span class="ui-button-text ui-c">Sign Up</span>
</button> </button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,37 +0,0 @@
$gray-lighter: #eceeef !default;
$image_path: "/assets/images/" !default;
$prefix: 'sigin';
.#{$prefix} {
&-conainer {
min-height: 100%;
background-size: cover;
padding: 100px;
}
&-main {
position: relative;
margin: 0 auto;
width: 500px;
}
}
.full-width {
width: 100%;
}
.help {
}
.is-danger {
}
.redirect {
font-size: 14px;
margin-left: 10px;
color: #00AAAA;
}

View File

@ -1 +1,41 @@
<div>signup</div> <form [formGroup]="signupForm" (ngSubmit)="signup()">
<div class="card login-panel ui-fluid">
<div class="ui-g">
<div class="ui-g-12">
<img src="assets/layout/images/logo-ultima.svg">
</div>
<div class="ui-g-12">
<span class="md-inputfield">
<input id="email" type="email" pInputText class="input ng-dirty ng-invalid" placeholder="Email" formControlName="email" required>
<div *ngIf="signupForm.get('email').touched && signupForm.get('email').errors" class="ui-message ui-messages-error ui-corner-all">
Not valid email
</div>
</span>
</div>
<div class="ui-g-12">
<span class="md-inputfield">
<input id="password" type="password" pInputText class="input ng-dirty ng-invalid" placeholder="Password" formControlName="password"
required #passwsord="ngModel">
<div #password *ngIf="signupForm.get('password').touched && signupForm.get('password').errors" class="ui-message ui-messages-error ui-corner-all">
Not valid password
</div>
</span>
</div>
<div class="ui-g-12">
<span class="md-inputfield">
<input id="pwConfirm" type="password" pInputText class="input ng-dirty ng-invalid" placeholder="Retype your password" formControlName="pwConfirm"
required validateEqual="password" #confirmPassword="ngModel">
<div *ngIf="pwConfirm.valid || (confirmPassword.pristine && !f.submitted)" class="ui-message ui-messages-error ui-corner-all">
Not matched password
</div>
</span>
</div>
<div class="ui-g-12">
<button type="submit" [disabled]="!signupForm.valid" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-left">
<span class="ui-button-icon-left ui-c fa fa-fw ui-icon-person"></span>
<span class="ui-button-text ui-c">Sign Up</span>
</button>
</div>
</div>
</div>
</form>

View File

@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { FormGroup, FormBuilder, Validators } from '@angular/forms'; import { FormGroup, FormBuilder, Validators, AbstractControl } from '@angular/forms';
import { Member } from '@loafer/core/reflect';
@Component({ @Component({
selector: 'of-member-signup', selector: 'of-member-signup',
@ -18,6 +19,7 @@ export class SignupComponent implements OnInit {
'phone': '', 'phone': '',
'company': '' 'company': ''
}; };
member: Member;
constructor( constructor(
private router: Router, private router: Router,
@ -36,15 +38,14 @@ export class SignupComponent implements OnInit {
] ]
], ],
'password': ['', [ 'password': ['', [
Validators.required,
Validators.pattern('^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$'), Validators.pattern('^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$'),
Validators.minLength(6), Validators.minLength(6),
Validators.maxLength(25) Validators.maxLength(25),
] ]
], ],
'pwConfirm': ['', [ 'pwConfirm': ['', [
Validators.pattern('^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$'), Validators.required,
Validators.minLength(6),
Validators.maxLength(25)
] ]
], ],
'name': ['', [ 'name': ['', [
@ -59,8 +60,17 @@ export class SignupComponent implements OnInit {
Validators.required Validators.required
] ]
], ],
}); }, this.pwdMatchValidator);
}
pwdMatchValidator(frm: FormGroup) {
return frm.get('password').value === frm.get('pwConfirm').value
? null : {'mismatch': true};
}
signup() {
const signinValue = Object.assign({}, this.signupForm.value);
console.log(signinValue);
} }
} }

View File

@ -7,6 +7,7 @@ import { MemberRESTModule } from './member-rest.module';
import { COMPONENTS } from './component'; import { COMPONENTS } from './component';
import { SERVICES } from './service'; import { SERVICES } from './service';
import { PrimeNGModules } from '../commons/prime-ng/prime-ng.module';
@NgModule({ @NgModule({
imports: [ imports: [
@ -16,6 +17,7 @@ import { SERVICES } from './service';
ReactiveFormsModule, ReactiveFormsModule,
MemberStoreModule, MemberStoreModule,
MemberRESTModule, MemberRESTModule,
PrimeNGModules
], ],
declarations: [ declarations: [
COMPONENTS, COMPONENTS,