Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
getme
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
amal
getme
Commits
8fa93f08
Commit
8fa93f08
authored
5 years ago
by
muhsin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some changes
parent
645657c4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
33 deletions
+104
-33
changedetails.page.html
src/app/changedetails/changedetails.page.html
+43
-16
changedetails.page.ts
src/app/changedetails/changedetails.page.ts
+34
-15
user.ts
src/config/services/user.ts
+4
-1
update.service.ts
src/config/update.service.ts
+23
-1
No files found.
src/app/changedetails/changedetails.page.html
View file @
8fa93f08
...
...
@@ -15,12 +15,13 @@
</div>
<div
class=
"row"
>
<input
[(
value
)]="
userData
&&
userData
.
name
"
name=
"name"
required
class=
""
type=
"text"
[(
ngModel
)]="
u
pdate
Data
.
name
"
placeholder=
"John Do
e"
[(
ngModel
)]="
u
serData
&&
user
Data
.
name
"
[(
placeholder
)]="
userData
&&
userData
.
nam
e
"
#
name=
"ngModel"
/>
<div
...
...
@@ -33,12 +34,13 @@
</div>
<div
class=
"row"
>
<input
[(
value
)]="
userData
&&
userData
.
emailId
"
required
class=
""
name=
"emailId"
type=
"mail"
[(
ngModel
)]="
u
pdate
Data
.
emailId
"
placeholder=
"johndoe@dummymail.com
"
[(
ngModel
)]="
u
serData
&&
user
Data
.
emailId
"
[(
placeholder
)]="
userData
&&
userData
.
emailId
"
pattern=
"[a-zA-Z0-9.-_]{1,}@[a-zA-Z.-]{2,}[.]{1}[a-zA-Z]{2,}"
#
emailId=
"ngModel"
/>
...
...
@@ -57,14 +59,15 @@
<div
class=
"row"
>
<input
[(
value
)]="
userData
&&
userData
.
phone
"
required
class=
""
name=
"phone"
type=
"number"
pattern=
"(\(+61\)|\+61|\(0[1-9]\)|0[1-9])?( ?-?[0-9]){6,9}"
maxlength=
"10"
[(
ngModel
)]="
u
pdate
Data
.
phone
"
placeholder=
"+00 9851 5871 6985
"
[(
ngModel
)]="
u
serData
&&
user
Data
.
phone
"
[(
placeholder
)]="
userData
&&
userData
.
phone
"
#
phone=
"ngModel"
/>
<div
...
...
@@ -79,18 +82,42 @@
</div>
</div>
</div>
<div
class=
"row"
>
<h6>
Change Password
</h6>
</div>
<div
class=
"row"
>
<div
*
ngIf=
"userData && userData.loginType == 0"
>
<div
class=
"row"
>
<h6>
Change Password
</h6>
</div>
<!-- <div class="row">
<input class="" type="password" placeholder="Current Password" />
</div> -->
<div
class=
"row"
>
<input
class=
""
[(
ngModel
)]="
updatePassword
.
password
"
name=
"password"
type=
"password"
placeholder=
"New Password"
minlength=
"6"
#
password=
"ngModel"
/>
<div
*
ngIf=
"password.errors && password.errors.minlength"
>
Password must be at least 6 characters
</div>
</div>
<div
class=
"row"
>
<input
class=
""
#
confirmPassword=
"ngModel"
[(
ngModel
)]="
updatePassword
.
confirmPassword
"
name=
"confirmPassword"
type=
"password"
placeholder=
"Confirm Password"
/>
<div
*
ngIf=
""
>
Password should match
</div>
</div>
</div>
<div
class=
"row"
>
<input
class=
""
type=
"password"
placeholder=
"New Password"
/>
</div>
<div
class=
"row"
>
<input
class=
""
type=
"password"
placeholder=
"Confirm Password"
/>
</div>
<div
class=
"row"
>
<button
class=
"login_btn"
(
click
)="
onFormSubmit
(
updateForm
)"
>
UPDATE
...
...
This diff is collapsed.
Click to expand it.
src/app/changedetails/changedetails.page.ts
View file @
8fa93f08
import
{
Component
,
OnInit
}
from
"@angular/core"
;
import
{
Location
}
from
"@angular/common"
;
import
{
Router
,
ActivatedRoute
}
from
"@angular/router"
;
import
{
UpdateUserDetails
}
from
"../../config/services/user"
;
import
{
UpdateService
}
from
"../../config/update.service"
;
import
{
ServiceService
}
from
"../../config/service.service"
;
import
{
NgForm
}
from
"@angular/forms"
;
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Location
}
from
'@angular/common'
;
import
{
Router
,
ActivatedRoute
}
from
'@angular/router'
;
import
{
UpdateUserDetails
,
UpdatePassword
}
from
'../../config/services/user'
;
import
{
UpdateService
}
from
'../../config/update.service'
;
import
{
ServiceService
}
from
'../../config/service.service'
;
import
{
NgForm
}
from
'@angular/forms'
;
@
Component
({
selector
:
"app-changedetails"
,
templateUrl
:
"./changedetails.page.html"
,
styleUrls
:
[
"./changedetails.page.scss"
]
selector
:
'app-changedetails'
,
templateUrl
:
'./changedetails.page.html'
,
styleUrls
:
[
'./changedetails.page.scss'
]
})
export
class
ChangedetailsPage
implements
OnInit
{
userData
:
any
;
updateData
:
UpdateUserDetails
=
{
emailId
:
""
,
name
:
""
,
phone
:
""
emailId
:
''
,
name
:
''
,
phone
:
''
};
updatePassword
:
UpdatePassword
=
{
password
:
''
,
confirmPassword
:
''
};
submitted
=
false
;
...
...
@@ -27,8 +32,10 @@ export class ChangedetailsPage implements OnInit {
public
register
:
UpdateService
,
private
service
:
ServiceService
)
{
this
.
service
.
get
(
"params"
).
then
(
val
=>
{
// Gets userdata
this
.
service
.
get
(
'params'
).
then
(
val
=>
{
this
.
userData
=
val
;
console
.
log
(
val
);
});
}
...
...
@@ -45,9 +52,21 @@ export class ChangedetailsPage implements OnInit {
onFormSubmit
(
form
:
NgForm
)
{
this
.
submitted
=
true
;
console
.
log
(
form
.
value
);
if
(
form
.
valid
)
{
console
.
log
(
"valid form values"
,
form
.
value
);
// Change Password
if
(
form
.
value
.
password
&&
form
.
value
.
password
!=
form
.
value
.
confirmPassword
)
{
this
.
register
.
updatePassword
(
form
.
value
.
password
);
}
else
{
alert
(
'Password should match'
);
}
// Calls update user data fn
this
.
register
.
updateData
(
form
.
value
,
this
.
userData
.
uid
);
console
.
log
(
'valid form values'
,
form
.
value
);
}
}
}
This diff is collapsed.
Click to expand it.
src/config/services/user.ts
View file @
8fa93f08
...
...
@@ -32,7 +32,10 @@ export interface UpdateUserDetails {
phone
:
string
;
}
// Model to Update Password
export
interface
UpdateUserDetails
{}
export
interface
UpdatePassword
{
password
:
string
;
confirmPassword
:
string
;
}
export
interface
Otp
{
uid
:
string
;
...
...
This diff is collapsed.
Click to expand it.
src/config/update.service.ts
View file @
8fa93f08
import
{
Injectable
}
from
"@angular/core"
;
import
{
User
,
UpdateUserDetails
,
Address
}
from
"./services/user"
;
import
{
User
,
UpdateUserDetails
,
Address
,
updatePassword
}
from
"./services/user"
;
import
{
auth
}
from
"firebase/app"
;
import
{
Router
,
ActivatedRoute
}
from
"@angular/router"
;
import
{
AngularFireAuth
}
from
"@angular/fire/auth"
;
...
...
@@ -69,4 +74,21 @@ export class UpdateService {
console
.
log
(
error
);
});
}
// Change Password
updatePassword
(
userData
:
updatePassword
)
{
// Gets current user
let
user
=
this
.
afAuth
.
auth
.
currentUser
;
let
newPassword
=
userData
.
password
;
// Update password
user
.
updatePassword
(
newPassword
)
.
then
(()
=>
{
console
.
log
(
"Password Changed"
);
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment