Merge branch 'master' of https://git.loafle.net/overflow/member_webapp
This commit is contained in:
commit
aef41c6adb
@ -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>
|
||||||
|
@ -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;
|
|
||||||
}
|
|
@ -1 +1,69 @@
|
|||||||
<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="email.touched && !email.valid" class="ui-message ui-messages-error ui-corner-all">
|
||||||
|
Invalid 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>
|
||||||
|
<div *ngIf="password.touched && !password.valid" class="ui-message ui-messages-error ui-corner-all">
|
||||||
|
Invalid 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>
|
||||||
|
<div *ngIf="pwConfirm.touched && !pwConfirm.valid" class="ui-message ui-messages-error ui-corner-all">
|
||||||
|
Not matched password
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-g-12">
|
||||||
|
<span class="md-inputfield">
|
||||||
|
<input id="name" type="text" pInputText class="input ng-dirty ng-invalid" placeholder="Name" formControlName="name" required>
|
||||||
|
<div *ngIf="name.touched && !name.valid" class="ui-message ui-messages-error ui-corner-all">
|
||||||
|
Invalid Name
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-g-12">
|
||||||
|
<span class="md-inputfield">
|
||||||
|
<input id="phone" type="text" pInputText class="input ng-dirty ng-invalid" placeholder="Phone" formControlName="phone" required>
|
||||||
|
<div *ngIf="phone.touched && !phone.valid" class="ui-message ui-messages-error ui-corner-all">
|
||||||
|
Invalid phone number
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-g-12">
|
||||||
|
<span class="md-inputfield">
|
||||||
|
<input id="company" type="text" pInputText class="input ng-dirty ng-invalid" placeholder="Company" formControlName="company" required>
|
||||||
|
<div *ngIf="company.touched && !company.valid" class="ui-message ui-messages-error ui-corner-all">
|
||||||
|
Invalid company name
|
||||||
|
</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>
|
@ -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, FormControl } from '@angular/forms';
|
||||||
|
import { Member } from '../../model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'of-member-signup',
|
selector: 'of-member-signup',
|
||||||
@ -10,14 +11,12 @@ import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
|||||||
export class SignupComponent implements OnInit {
|
export class SignupComponent implements OnInit {
|
||||||
|
|
||||||
signupForm: FormGroup;
|
signupForm: FormGroup;
|
||||||
formErrors = {
|
email: AbstractControl;
|
||||||
'email': '',
|
password: AbstractControl;
|
||||||
'password': '',
|
pwConfirm: AbstractControl;
|
||||||
'pwConfirm': '',
|
name: AbstractControl;
|
||||||
'name': '',
|
phone: AbstractControl;
|
||||||
'phone': '',
|
company: AbstractControl;
|
||||||
'company': ''
|
|
||||||
};
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router,
|
private router: Router,
|
||||||
@ -36,15 +35,16 @@ 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.compose([
|
||||||
Validators.minLength(6),
|
Validators.required, this.pwMatchValidator
|
||||||
Validators.maxLength(25)
|
])
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'name': ['', [
|
'name': ['', [
|
||||||
@ -60,7 +60,34 @@ export class SignupComponent implements OnInit {
|
|||||||
]
|
]
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
this.email = this.signupForm.controls['email'];
|
||||||
|
this.password = this.signupForm.controls['password'];
|
||||||
|
this.pwConfirm = this.signupForm.controls['pwConfirm'];
|
||||||
|
this.name = this.signupForm.controls['name'];
|
||||||
|
this.phone = this.signupForm.controls['phone'];
|
||||||
|
this.company = this.signupForm.controls['company'];
|
||||||
|
}
|
||||||
|
|
||||||
|
pwMatchValidator(control: FormControl): { [s: string]: boolean } {
|
||||||
|
let pw;
|
||||||
|
if (control.parent) {
|
||||||
|
pw = control.parent.controls['password'].value;
|
||||||
|
}
|
||||||
|
if (control.value !== pw) {
|
||||||
|
return { notMatched: true };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
signup() {
|
||||||
|
const signinValue = Object.assign({}, this.signupForm.value);
|
||||||
|
const member: Member = {
|
||||||
|
email: signinValue.email,
|
||||||
|
password: signinValue.password,
|
||||||
|
name: signinValue.name,
|
||||||
|
phone: signinValue.phone,
|
||||||
|
companyName: signinValue.company,
|
||||||
|
};
|
||||||
|
console.log(member);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user