AuthGuard commented out & sector added to registration

This commit is contained in:
piratefinn 2017-06-29 13:47:41 +01:00
parent 0e6529db85
commit 23b5dbde6e
4 changed files with 87 additions and 52 deletions

View file

@ -15,7 +15,7 @@ export const routes: Routes = [
{ {
path: '', path: '',
component: FullLayoutComponent, component: FullLayoutComponent,
canActivate: [AuthGuard], // canActivate: [AuthGuard],
data: { data: {
title: 'Home' title: 'Home'
}, },

View file

@ -17,87 +17,120 @@
</div> --> </div> -->
<form [formGroup]="signupForm.getForm()"> <form [formGroup]="signupForm.getForm()">
<div class="input-group mb-3"> <div class="input-group mb-3">
<span class="input-group-addon"><i class="icon-key"></i></span> <span class="input-group-addon"><i class="icon-key"></i></span>
<input type="text" class="form-control" formControlName="token" placeholder="Token"> <input type="text" class="form-control" formControlName="token" placeholder="Token">
</div> </div>
<div class="input-group mb-3"> <div class="input-group mb-3">
<span class="input-group-addon">@</span> <span class="input-group-addon">@</span>
<input type="text" class="form-control" formControlName="email" placeholder="Email"> <input type="text" class="form-control" formControlName="email" placeholder="Email">
</div> </div>
<div class="input-group mb-3"> <div class="input-group mb-3">
<span class="input-group-addon"><i class="icon-lock"></i></span> <span class="input-group-addon"><i class="icon-lock"></i></span>
<input type="password" class="form-control" formControlName="password" placeholder="Password"> <input type="password" class="form-control" formControlName="password" placeholder="Password">
</div> </div>
<div class="input-group mb-4"> <div class="input-group mb-4">
<span class="input-group-addon"><i class="icon-lock"></i></span> <span class="input-group-addon"><i class="icon-lock"></i></span>
<input type="password" class="form-control" formControlName="confirmpassword" placeholder="Repeat password"> <input type="password" class="form-control" formControlName="confirmpassword" placeholder="Repeat password">
</div> </div>
<div class="input-group mb-3"> <div class="input-group mb-3">
<span class="input-group-addon"><i class="icon-people"></i></span> <span class="input-group-addon"><i class="icon-people"></i></span>
<select required class="form-control" type="text" formControlName="usertype"> <select required class="form-control" type="text" formControlName="usertype">
<option value=''>Please select</option> <option value=''>Please select</option>
<option value='organisation'>Organisation</option> <option value='organisation'>Organisation</option>
<option value='customer'>Customer</option> <option value='customer'>Customer</option>
</select> </select>
</div> </div>
</form> </form>
<div [ngSwitch]="signupForm.getForm().value.usertype"> <div [ngSwitch]="signupForm.getForm().value.usertype">
<div *ngSwitchCase="'customer'" > <div *ngSwitchCase="'customer'" >
<form [formGroup]="customerForm.getForm()" (ngSubmit)="onSubmitCustomer()"> <form [formGroup]="customerForm.getForm()" (ngSubmit)="onSubmitCustomer()">
<div class="input-group mb-3"> <div class="input-group mb-3">
<span class="input-group-addon"><i class="icon-user"></i></span> <span class="input-group-addon"><i class="icon-user"></i></span>
<input type="text" class="form-control" formControlName="display_name" placeholder="Display Name"> <input type="text" class="form-control" formControlName="display_name" placeholder="Display Name">
</div> </div>
<div class="input-group mb-3"> <div class="input-group mb-3">
<span class="input-group-addon"><i class="icon-user"></i></span> <span class="input-group-addon"><i class="icon-user"></i></span>
<input type="text" class="form-control" formControlName="full_name" placeholder="Full Name"> <input type="text" class="form-control" formControlName="full_name" placeholder="Full Name">
</div> </div>
<div class="input-group mb-3"> <div class="input-group mb-3">
<span class="input-group-addon"><i class="icon-user"></i></span> <span class="input-group-addon"><i class="icon-user"></i></span>
<input type="text" class="form-control" formControlName="postcode" placeholder="Postcode"> <input type="text" class="form-control" formControlName="postcode" placeholder="Postcode">
</div> </div>
<div class="input-group mb-3"> <div class="input-group mb-3">
<span class="input-group-addon">Year of Birth</span> <span class="input-group-addon">Year of Birth</span>
<select class="form-control" type="text" formControlName="year_of_birth"> <select class="form-control" type="text" formControlName="year_of_birth">
<option *ngFor="let range of years" [value]="range">{{ range }}</option> <option *ngFor="let range of years" [value]="range">{{ range }}</option>
</select> </select>
</div> </div>
<button type="submit" class="btn btn-block btn-success">Create Account</button> <button type="submit" class="btn btn-block btn-success">Create Account</button>
</form> </form>
</div> </div>
<div *ngSwitchCase="'organisation'"> <div *ngSwitchCase="'organisation'">
<form [formGroup]="organisationForm.getForm()" (ngSubmit)="onSubmitOrganisation()"> <form [formGroup]="organisationForm.getForm()" (ngSubmit)="onSubmitOrganisation()">
<div class="input-group mb-3"> <div class="input-group mb-3">
<span class="input-group-addon"><i class="icon-user"></i></span> <span class="input-group-addon"><i class="icon-user"></i></span>
<input type="text" class="form-control" formControlName="name" placeholder="Organisation Name"> <input type="text" class="form-control" formControlName="name" placeholder="Organisation Name">
</div> </div>
<!-- Uses the UK SIC 2007 classifications for sector as used by ONS -->
<div class="input-group mb-3">
<select required class="form-control" type="text" formControlName="sector">
<option value=''>Select Organisation Sector</option>
<option value='A'>Agriculture, Forestry & Fishing</option>
<option value='B'>Mining & Quarrying</option>
<option value='C'>Manufacturing</option>
<option value='D'>Electricity, Gas, Steam & Air Conditiioning</option>
<option value='E'>Water & Waste Management</option>
<option value='F'>Construction</option>
<option value='G'>Wholesale & Retail Trade</option>
<option value='H'>Transportation & Storage</option>
<option value='I'>Accomodation & Food Services</option>
<option value='J'>Information & Communication</option>
<option value='K'>Financial & Insurance Activities</option>
<option value='L'>Real Estate</option>
<option value='M'>Professional, Scientfic & Technical</option>
<option value='N'>Administrative & Support Services</option>
<option value='O'>Public Administration, Defence & Social Security</option>
<option value='P'>Education</option>
<option value='Q'>Human Health & Social Work</option>
<option value='R'>Arts, Entertainment & Recreation</option>
<option value='S'>Other Service Activities</option>
<option value='T'>Household Domestic Business</option>
</select>
</div>
<div class="input-group mb-3"> <div class="input-group mb-3">
<span class="input-group-addon"><i class="icon-user"></i></span> <span class="input-group-addon"><i class="icon-user"></i></span>
<input type="text" class="form-control" formControlName="street_name" placeholder="Street Name"> <input type="text" class="form-control" formControlName="street_name" placeholder="Street Name">
</div> </div>
<div class="input-group mb-3"> <div class="input-group mb-3">
<span class="input-group-addon"><i class="icon-user"></i></span> <span class="input-group-addon"><i class="icon-user"></i></span>
<input type="text" class="form-control" formControlName="town" placeholder="Town"> <input type="text" class="form-control" formControlName="town" placeholder="Town">
</div> </div>
<div class="input-group mb-3">
<span class="input-group-addon"><i class="icon-user"></i></span>
<input type="text" class="form-control" formControlName="town" placeholder="Town">
</div>
<div class="input-group mb-3"> <div class="input-group mb-3">
<span class="input-group-addon"><i class="icon-user"></i></span> <span class="input-group-addon"><i class="icon-user"></i></span>
<input type="text" class="form-control" formControlName="postcode" placeholder="Postcode"> <input type="text" class="form-control" formControlName="postcode" placeholder="Postcode">
</div> </div>
<button type="submit" class="btn btn-block btn-success">Create Account</button> <button type="submit" class="btn btn-block btn-success">Create Account</button>
</form> </form>
</div> </div>
<div heading="Pending" *ngSwitchDefault>Please Select a User Type</div> <div heading="Pending" *ngSwitchDefault>Please Select a User Type</div>
</div> </div>

View file

@ -41,10 +41,11 @@ export class RegisterComponent {
display_name: 'required', display_name: 'required',
full_name: 'required', full_name: 'required',
postcode: 'required', postcode: 'required',
year_of_birth: 'required', year_of_birth:'required',
}); });
this.organisationForm = new ValidationManager({ this.organisationForm = new ValidationManager({
name: 'required', name: 'required',
name: 'sector',
street_name: 'required', street_name: 'required',
town: 'required', town: 'required',
postcode: 'required', postcode: 'required',
@ -100,6 +101,7 @@ export class RegisterComponent {
email: signupForm.email, email: signupForm.email,
password: signupForm.password, password: signupForm.password,
name: organisationForm.name, name: organisationForm.name,
name: organisationForm.sector,
street_name: organisationForm.street_name, street_name: organisationForm.street_name,
town: organisationForm.town, town: organisationForm.town,
postcode: organisationForm.postcode, postcode: organisationForm.postcode,