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
b31b005b
Commit
b31b005b
authored
Jun 14, 2020
by
chamath
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working sample added for the social login.
parent
545ecfb9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
4 deletions
+42
-4
app.service.ts
frontend/angular/src/app/app.service.ts
+13
-1
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
+27
-1
No files found.
frontend/angular/src/app/app.service.ts
View file @
b31b005b
...
@@ -3,6 +3,7 @@ import { Observable } from 'rxjs';
...
@@ -3,6 +3,7 @@ import { Observable } from 'rxjs';
import
{
MessageTemplateModel
}
from
'./models/message-template.model'
;
import
{
MessageTemplateModel
}
from
'./models/message-template.model'
;
import
{
PlaceholderOptionsEnum
}
from
'./models/placeholder-options.enum'
;
import
{
PlaceholderOptionsEnum
}
from
'./models/placeholder-options.enum'
;
import
{
TemplateTypeEnum
}
from
'./models/template-type.enum'
;
import
{
TemplateTypeEnum
}
from
'./models/template-type.enum'
;
import
{
ApiService
}
from
'./oneit/services/api.service'
;
import
{
EnumService
}
from
'./oneit/services/enum.service'
;
import
{
EnumService
}
from
'./oneit/services/enum.service'
;
import
{
SearchService
}
from
'./oneit/services/search.service'
;
import
{
SearchService
}
from
'./oneit/services/search.service'
;
import
{
UtilsService
}
from
'./oneit/services/utils.service'
;
import
{
UtilsService
}
from
'./oneit/services/utils.service'
;
...
@@ -14,7 +15,8 @@ export class AppService {
...
@@ -14,7 +15,8 @@ export class AppService {
constructor
(
constructor
(
private
enumService
:
EnumService
,
private
enumService
:
EnumService
,
private
searchService
:
SearchService
,
private
searchService
:
SearchService
,
private
utilsService
:
UtilsService
private
utilsService
:
UtilsService
,
private
apiService
:
ApiService
,
)
{
)
{
}
}
...
@@ -53,4 +55,14 @@ export class AppService {
...
@@ -53,4 +55,14 @@ export class AppService {
}
}
);
);
}
}
socicalMediaLogin
(
svc
,
params
)
{
return
this
.
apiService
.
post
(
'svc/'
+
svc
,
params
).
map
(
data
=>
{
if
(
this
.
utilsService
.
isSuccessfulResponse
(
data
))
{
return
data
;
}
}
);
}
}
}
frontend/angular/src/app/components/my-career-web/auth/login/login.component.html
View file @
b31b005b
...
@@ -36,12 +36,12 @@
...
@@ -36,12 +36,12 @@
<div
class=
"d-flex justify-content-center"
>
<div
class=
"d-flex justify-content-center"
>
<button
class=
"action-btn google-login"
[
disabled
]="
isLoading
"
>
Sign in with Google
</button>
<button
class=
"action-btn google-login"
(
click
)="
socicalMediaLogin
('
google
')"
[
disabled
]="
isLoading
"
>
Sign in with Google
</button>
</div>
</div>
<div
class=
"d-flex justify-content-center"
>
<div
class=
"d-flex justify-content-center"
>
<button
class=
"action-btn linkedin-login"
[
disabled
]="
isLoading
"
>
Sign in with Linkedin
</button>
<button
class=
"action-btn linkedin-login"
(
click
)="
socicalMediaLogin
('
linkedIn
')"
[
disabled
]="
isLoading
"
>
Sign in with Linkedin
</button>
</div>
</div>
</form>
</form>
</div>
</div>
...
...
frontend/angular/src/app/components/my-career-web/auth/login/login.component.ts
View file @
b31b005b
import
{
Component
,
ViewChild
}
from
'@angular/core'
;
import
{
Component
,
ViewChild
}
from
'@angular/core'
;
import
{
NgForm
}
from
'@angular/forms'
;
import
{
NgForm
}
from
'@angular/forms'
;
import
{
Router
}
from
'@angular/router'
;
import
{
Router
}
from
'@angular/router'
;
import
{
Subscription
}
from
'rxjs'
;
import
{
takeUntil
}
from
'rxjs/operators'
;
import
{
takeUntil
}
from
'rxjs/operators'
;
import
{
environment
}
from
'../../../../../environments/environment'
;
import
{
AppService
}
from
'../../../../app.service'
;
import
{
BaseComponent
}
from
'../../base/base.component'
;
import
{
BaseComponent
}
from
'../../base/base.component'
;
import
{
AuthService
}
from
'../../services/auth.service'
;
import
{
AuthService
}
from
'../../services/auth.service'
;
import
{
HelperService
}
from
'../../services/helper.service'
;
import
{
HelperService
}
from
'../../services/helper.service'
;
...
@@ -15,6 +18,7 @@ import { HelperService } from '../../services/helper.service';
...
@@ -15,6 +18,7 @@ import { HelperService } from '../../services/helper.service';
export
class
LoginComponent
extends
BaseComponent
{
export
class
LoginComponent
extends
BaseComponent
{
year
=
new
Date
().
getFullYear
();
year
=
new
Date
().
getFullYear
();
subscriptions
:
Array
<
Subscription
>
=
[];
loginForm
=
{
loginForm
=
{
username
:
''
,
username
:
''
,
...
@@ -25,7 +29,8 @@ export class LoginComponent extends BaseComponent {
...
@@ -25,7 +29,8 @@ export class LoginComponent extends BaseComponent {
constructor
(
constructor
(
private
hs
:
HelperService
,
private
hs
:
HelperService
,
private
as
:
AuthService
,
private
as
:
AuthService
,
private
r
:
Router
private
r
:
Router
,
private
appService
:
AppService
)
{
)
{
super
();
super
();
}
}
...
@@ -84,4 +89,25 @@ export class LoginComponent extends BaseComponent {
...
@@ -84,4 +89,25 @@ export class LoginComponent extends BaseComponent {
});
});
}
}
socicalMediaLogin
(
type
:
string
)
{
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
=>
{
if
(
data
.
destination
)
{
window
.
location
.
href
=
data
.
destination
;
return
;
}
},
error
=>
{
}
)
);
}
}
}
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