Sign up pages
This commit is contained in:
@@ -41,7 +41,8 @@ getBlogData(){
|
||||
username: string, password: string, sessionid: string
|
||||
};
|
||||
startLogin() {
|
||||
this.username='ses66181+6018@gmail.com';
|
||||
// this.username='ses66181+6018@gmail.com';
|
||||
this.username='ses66181+1@gmail.com';
|
||||
this.password='may12002';
|
||||
if (this.username == null || this.username == '' || this.validateEmail(this.username) == false || this.password == null || this.password == '') {
|
||||
this.showAlert('Invalid Login', 'Enter username(email) and password to login');
|
||||
|
||||
@@ -1,68 +1,111 @@
|
||||
<ion-content class="ion-padding">
|
||||
<div class="ion-padding space">
|
||||
<div>
|
||||
<div *ngIf="signup_state==1; then startBlock"></div>
|
||||
<div *ngIf="signup_state==2; then secondBlock"></div>
|
||||
<ng-template #startBlock>
|
||||
<div>
|
||||
|
||||
<ion-label class="simp_lbl">Create Your Account</ion-label>
|
||||
<ion-item lines="none">
|
||||
<ion-label>Nigeria</ion-label>
|
||||
<ion-icon name="caret-down-outline"></ion-icon>
|
||||
</ion-item>
|
||||
<ion-label class="simp_lbl">Create Your Account</ion-label>
|
||||
<ion-item lines="none">
|
||||
<ion-select label="Default label" placeholder="Select Country" [(ngModel)]='country'>
|
||||
<ion-select-option value="NG">Nigeria</ion-select-option>
|
||||
<ion-select-option value="US">United States</ion-select-option>
|
||||
</ion-select>
|
||||
<!-- <ion-label>Nigeria</ion-label>-->
|
||||
<!-- <ion-icon name="caret-down-outline"></ion-icon>-->
|
||||
</ion-item>
|
||||
|
||||
|
||||
<ion-item lines="none">
|
||||
<ion-icon slot="start" name="person-outline"></ion-icon>
|
||||
<ion-input type="firstname" placeholder="Firstname" [(ngModel)]='firstname'></ion-input>
|
||||
</ion-item>
|
||||
<ion-item lines="none">
|
||||
<ion-icon slot="start" name="person-outline"></ion-icon>
|
||||
<ion-input type="firstname" placeholder="Firstname" [(ngModel)]='firstname'></ion-input>
|
||||
</ion-item>
|
||||
|
||||
|
||||
<ion-item lines="none">
|
||||
<ion-icon slot="start" name="person-outline"></ion-icon>
|
||||
<ion-input type="lastname" placeholder="Lastname" [(ngModel)]='lastname'></ion-input>
|
||||
</ion-item>
|
||||
<ion-item lines="none">
|
||||
<ion-icon slot="start" name="person-outline"></ion-icon>
|
||||
<ion-input type="lastname" placeholder="Lastname" [(ngModel)]='lastname'></ion-input>
|
||||
</ion-item>
|
||||
|
||||
|
||||
<ion-item lines="none">
|
||||
<ion-icon slot="start" name="mail-outline"></ion-icon>
|
||||
<ion-input type="username" placeholder="Email (your username)" [(ngModel)]='username'></ion-input>
|
||||
</ion-item>
|
||||
<ion-item lines="none">
|
||||
<ion-icon slot="start" name="mail-outline"></ion-icon>
|
||||
<ion-input type="username" placeholder="Email (your username)" [(ngModel)]='username'></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item lines="none">
|
||||
<ion-icon slot="start" name="lock-closed-outline"></ion-icon>
|
||||
<ion-input type="password" placeholder="Password" [(ngModel)]='password'></ion-input>
|
||||
</ion-item>
|
||||
<ion-item lines="none">
|
||||
<ion-icon slot="start" name="lock-closed-outline"></ion-icon>
|
||||
<ion-input type="password" placeholder="Password" [(ngModel)]='password'></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<!-- <ion-item lines="none">-->
|
||||
<!-- <ion-icon slot="start" name="lock-closed-outline"></ion-icon>-->
|
||||
<!-- <ion-input type="password" placeholder="Confirm Password"></ion-input>-->
|
||||
<!-- </ion-item>-->
|
||||
<!-- <ion-item lines="none">-->
|
||||
<!-- <ion-icon slot="start" name="lock-closed-outline"></ion-icon>-->
|
||||
<!-- <ion-input type="password" placeholder="Confirm Password"></ion-input>-->
|
||||
<!-- </ion-item>-->
|
||||
|
||||
<ion-button expand="block" (click)="onFillProfile()">
|
||||
Register
|
||||
</ion-button>
|
||||
<ion-button expand="block" (click)="onFillProfile()">
|
||||
Register
|
||||
</ion-button>
|
||||
|
||||
|
||||
<ion-label class="or">Or Continue With</ion-label>
|
||||
<ion-label class="or">Or Continue With</ion-label>
|
||||
|
||||
<div class="button">
|
||||
<ion-buttons>
|
||||
<ion-button>
|
||||
<ion-icon name="logo-facebook"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
<div class="button">
|
||||
<ion-buttons>
|
||||
<ion-button>
|
||||
<ion-icon name="logo-facebook"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
|
||||
<ion-buttons>
|
||||
<ion-button>
|
||||
<ion-icon name="logo-google"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
<ion-buttons>
|
||||
<ion-button>
|
||||
<ion-icon name="logo-google"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
|
||||
<ion-buttons>
|
||||
<ion-button>
|
||||
<ion-icon name="logo-twitter"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
<ion-buttons>
|
||||
<ion-button>
|
||||
<ion-icon name="logo-twitter"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template #secondBlock>
|
||||
<div>
|
||||
|
||||
<ion-label class="simp_lbl">Complete Account</ion-label>
|
||||
|
||||
<ion-grid>
|
||||
<ion-row>
|
||||
<ion-col size-md="3">Country</ion-col>
|
||||
<ion-col size-md="9">{{country}}</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col size-md="3">Username</ion-col>
|
||||
<ion-col size-md="9">{{username}}</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
<ion-label class="or">Enter Confirmation Received In Email</ion-label>
|
||||
<ion-item lines="none">
|
||||
<ion-icon slot="start" name="mail-outline"></ion-icon>
|
||||
<ion-input type="username" placeholder="Random text" [(ngModel)]='random_text'></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item lines="none">
|
||||
<ion-icon slot="start" name="lock-closed-outline"></ion-icon>
|
||||
<ion-input type="password" placeholder="Password" [(ngModel)]='password'></ion-input>
|
||||
</ion-item>
|
||||
<ion-button expand="block" (click)="onCompleteProfile()">
|
||||
Complete signup
|
||||
</ion-button>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<div class="bottom">
|
||||
<ion-label class="last_lbl">Already have an account? <span (click)="onLogin()">Login</span></ion-label>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { Router } from '@angular/router';
|
||||
import {Component, OnInit, ViewChild} from '@angular/core';
|
||||
import {ToastController} from "@ionic/angular";
|
||||
import {NavController} from "@ionic/angular";
|
||||
import { WrenchService } from 'src/app/services/wrench.service';
|
||||
import {SessionDataProviderService} from "../../store/session-data-provider.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-register',
|
||||
@@ -13,6 +16,11 @@ export class RegisterPage implements OnInit {
|
||||
@ViewChild('firstname') firstname;
|
||||
@ViewChild('lastname') lastname;
|
||||
@ViewChild('country') country;
|
||||
|
||||
@ViewChild('random_text') random_text;
|
||||
|
||||
pending_uid:string = '';
|
||||
signup_state:number = 1;
|
||||
/*
|
||||
'firstname': 'OluNG' ,
|
||||
'lastname': 'AmeyNG' ,
|
||||
@@ -25,9 +33,26 @@ export class RegisterPage implements OnInit {
|
||||
'country': 'NG' ,
|
||||
'action' => 11010
|
||||
*/
|
||||
|
||||
signupData: {
|
||||
action:11010,
|
||||
firstname: string,
|
||||
lastname: string,
|
||||
username: string,
|
||||
email: string,
|
||||
password: string,
|
||||
terms: number,
|
||||
news: number,
|
||||
country: string,
|
||||
sessionid: string
|
||||
};
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private toastController: ToastController
|
||||
private toastController: ToastController,
|
||||
private navctr: NavController,
|
||||
public sessionDataProviderService: SessionDataProviderService,
|
||||
private wrenchService: WrenchService
|
||||
) {
|
||||
|
||||
}
|
||||
@@ -38,20 +63,88 @@ export class RegisterPage implements OnInit {
|
||||
onLogin() {
|
||||
this.router.navigate(['login']);
|
||||
}
|
||||
signUpResult:any;
|
||||
signUpData: [];
|
||||
|
||||
onFillProfile() {
|
||||
|
||||
//debugger;
|
||||
|
||||
if (this.username == null || this.username == '' || this.validateEmail(this.username) == false
|
||||
|| this.password == null || this.password == ''
|
||||
|| this.firstname == null || this.firstname == ''
|
||||
|| this.lastname == null || this.lastname == '') {
|
||||
|| this.lastname == null || this.lastname == ''
|
||||
|| this.country == null || this.country == ''
|
||||
) {
|
||||
this.presentToast('Missing Required Inputs', 'middle');
|
||||
return;
|
||||
}
|
||||
//this.router.navigate(['fill-profile']);
|
||||
alert("WE CALL API NOW");
|
||||
|
||||
this.signupData= {
|
||||
action:11010,
|
||||
firstname: this.firstname,
|
||||
lastname: this.lastname,
|
||||
username: this.username,
|
||||
email: this.username,
|
||||
password: this.password,
|
||||
terms: 1,
|
||||
news: 1,
|
||||
country: this.country,
|
||||
sessionid: "SSSSS-SSSSSS-SSSSSS"
|
||||
};
|
||||
this.pending_uid = "";
|
||||
|
||||
this.wrenchService.createUser(this.signupData).subscribe(
|
||||
signUpResult => {
|
||||
this.signUpResult = signUpResult;
|
||||
console.log("signUpResult RETURN->", this.signUpResult);
|
||||
|
||||
if (this.signUpResult.internal_return > 0 && this.signUpResult?.uid != ''){
|
||||
this.pending_uid = this.signUpResult.uid;
|
||||
this.signup_state =2;
|
||||
}
|
||||
else {
|
||||
this.presentToast('Unable to continue with this params', 'middle');
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
completeSignupData: {
|
||||
action:11010,
|
||||
username: string,
|
||||
random_text: string,
|
||||
password: string,
|
||||
pending_uid:string,
|
||||
mobile: string,
|
||||
sessionid: string
|
||||
};
|
||||
|
||||
onCompleteProfile(){
|
||||
this.completeSignupData = {
|
||||
action:11010,
|
||||
username: this.username,
|
||||
random_text: this.random_text,
|
||||
password: this.password,
|
||||
pending_uid: this.pending_uid,
|
||||
mobile: "MOBILE",
|
||||
sessionid: "ABOUT-TO_START"
|
||||
};
|
||||
console.log("COMPLETE SIGNUP ",this.completeSignupData);
|
||||
|
||||
this.wrenchService.completeMobileSignup(this.completeSignupData).subscribe(
|
||||
signUpResult => {
|
||||
this.signUpResult = signUpResult;
|
||||
if (signUpResult != null && signUpResult.internal_return == 100 && this.sessionDataProviderService.ConstructGlobalSessionData(this.signUpResult) == true) {
|
||||
// this.getBlogData();
|
||||
this.router.navigate(['tabs/tab1']);
|
||||
}
|
||||
else{
|
||||
alert("SOME FAILURE");
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
//
|
||||
alert(100);
|
||||
}
|
||||
showAlert(mtitle: string, amessage: string) {
|
||||
/* let alert = this.alertCtrl.create({
|
||||
|
||||
@@ -24,6 +24,23 @@ export class WrenchService {
|
||||
);
|
||||
}
|
||||
|
||||
createUser(reqData) {
|
||||
return this.getPostData('createuser', reqData);
|
||||
}
|
||||
completeMobileSignup(reqData) {
|
||||
return this.getPostData('completemobileuser', reqData);
|
||||
}
|
||||
|
||||
//
|
||||
signUpCountry(apiData) {
|
||||
/*
|
||||
array (size=3)
|
||||
'limit' => int 10
|
||||
'page' => string '1' (length=1)
|
||||
'action' => int 1200021
|
||||
*/
|
||||
return this.getPostData('signupcountry',apiData);
|
||||
}
|
||||
getMyNotifications(usrData) {
|
||||
return this.getPostData('mynotifications',usrData);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user