Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PERFORMA_REPLICA
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
Muhammad Usman
PERFORMA_REPLICA
Commits
f9fda747
Commit
f9fda747
authored
Jun 15, 2020
by
Muhammad Usman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
social login added
parent
b31b005b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
44 deletions
+12
-44
login.component.html
.../components/my-career-web/auth/login/login.component.html
+2
-2
login.component.ts
...pp/components/my-career-web/auth/login/login.component.ts
+10
-42
No files found.
frontend/angular/src/app/components/my-career-web/auth/login/login.component.html
View file @
f9fda747
...
...
@@ -36,12 +36,12 @@
<div
class=
"d-flex justify-content-center"
>
<button
class=
"action-btn google-login"
(
click
)="
soci
c
alMediaLogin
('
google
')"
[
disabled
]="
isLoading
"
>
Sign in with Google
</button>
<button
class=
"action-btn google-login"
(
click
)="
socialMediaLogin
('
google
')"
[
disabled
]="
isLoading
"
>
Sign in with Google
</button>
</div>
<div
class=
"d-flex justify-content-center"
>
<button
class=
"action-btn linkedin-login"
(
click
)="
soci
c
alMediaLogin
('
linkedIn
')"
[
disabled
]="
isLoading
"
>
Sign in with Linkedin
</button>
<button
class=
"action-btn linkedin-login"
(
click
)="
socialMediaLogin
('
linkedIn
')"
[
disabled
]="
isLoading
"
>
Sign in with Linkedin
</button>
</div>
</form>
</div>
...
...
frontend/angular/src/app/components/my-career-web/auth/login/login.component.ts
View file @
f9fda747
import
{
Component
,
ViewChild
}
from
'@angular/core'
;
import
{
NgForm
}
from
'@angular/forms'
;
import
{
Router
}
from
'@angular/router'
;
import
{
Subscription
}
from
'rxjs'
;
import
{
takeUntil
}
from
'rxjs/operators'
;
import
{
environment
}
from
'../../../../../environments/environment'
;
import
{
AppService
}
from
'../../../../app.service'
;
...
...
@@ -18,7 +17,6 @@ import { HelperService } from '../../services/helper.service';
export
class
LoginComponent
extends
BaseComponent
{
year
=
new
Date
().
getFullYear
();
subscriptions
:
Array
<
Subscription
>
=
[];
loginForm
=
{
username
:
''
,
...
...
@@ -30,7 +28,7 @@ export class LoginComponent extends BaseComponent {
private
hs
:
HelperService
,
private
as
:
AuthService
,
private
r
:
Router
,
private
ap
pService
:
AppService
private
ap
s
:
AppService
)
{
super
();
}
...
...
@@ -57,57 +55,27 @@ export class LoginComponent extends BaseComponent {
});
}
googleLogin
():
void
{
this
.
isLoading
=
true
;
this
.
as
.
googleLogin
()
.
pipe
(
takeUntil
(
this
.
componentInView
))
.
subscribe
(
response
=>
{
this
.
hs
.
oneItHttpResponse
(
response
);
// if (response.status === 'error') {
// this.loginForm.password = '';
// }
this
.
isLoading
=
false
;
},
err
=>
{
this
.
hs
.
handleHttpError
(
err
);
this
.
isLoading
=
false
;
});
}
linkedInLogin
():
void
{
this
.
isLoading
=
true
;
this
.
as
.
linkedinLogin
()
.
pipe
(
takeUntil
(
this
.
componentInView
))
.
subscribe
(
response
=>
{
this
.
hs
.
oneItHttpResponse
(
response
);
// if (response.status === 'error') {
// this.loginForm.password = '';
// }
this
.
isLoading
=
false
;
},
err
=>
{
this
.
hs
.
handleHttpError
(
err
);
this
.
isLoading
=
false
;
});
}
socicalMediaLogin
(
type
:
string
)
{
socialMediaLogin
(
type
:
'google'
|
'linkedIn'
)
{
const
params
=
{
environment
:
environment
.
envName
,
nextPage
:
window
.
location
.
href
.
split
(
'/#/'
)[
0
]
+
'/#/my-career-web/dashboard/home'
};
const
svc
=
type
===
'linkedIn'
?
'LoginWithLinkedIn'
:
'LoginWithGoogle'
;
this
.
subscriptions
.
push
(
this
.
appService
.
socicalMediaLogin
(
svc
,
params
)
.
subscribe
(
data
=>
{
this
.
isLoading
=
true
;
this
.
aps
.
socicalMediaLogin
(
svc
,
params
)
.
pipe
(
takeUntil
(
this
.
componentInView
))
.
subscribe
(
data
=>
{
this
.
isLoading
=
false
;
if
(
data
.
destination
)
{
window
.
location
.
href
=
data
.
destination
;
return
;
}
},
error
=>
{
err
=>
{
this
.
hs
.
handleHttpError
(
err
);
this
.
isLoading
=
false
;
}
)
);
}
}
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