diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 5f5ab10..92eca62 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -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'); diff --git a/src/app/pages/register/register.page.html b/src/app/pages/register/register.page.html index 92d6f33..55139bd 100644 --- a/src/app/pages/register/register.page.html +++ b/src/app/pages/register/register.page.html @@ -1,68 +1,111 @@
-
+
+
+ +
- Create Your Account - - Nigeria - - + Create Your Account + + + Nigeria + United States + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - Register - + + Register + - Or Continue With + Or Continue With -
- - - - - +
+ + + + + - - - - - + + + + + - - - - - + + + + + +
-
+
+ +
+ + Complete Account + + + + Country + {{country}} + + + Username + {{username}} + + + Enter Confirmation Received In Email + + + + + + + + + + + Complete signup + + + + + +
+
+
Already have an account? Login
diff --git a/src/app/pages/register/register.page.ts b/src/app/pages/register/register.page.ts index b081ee5..86239d3 100644 --- a/src/app/pages/register/register.page.ts +++ b/src/app/pages/register/register.page.ts @@ -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({ diff --git a/src/app/services/wrench.service.ts b/src/app/services/wrench.service.ts index 5e0efaf..8f83cbc 100644 --- a/src/app/services/wrench.service.ts +++ b/src/app/services/wrench.service.ts @@ -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); }