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
1b1ebd13
Commit
1b1ebd13
authored
Jun 09, 2020
by
Pankaj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added sample code for Login with Google & LinkedIn
parent
78278622
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
0 deletions
+109
-0
login-options.component.html
...l_code/angular/login-options/login-options.component.html
+25
-0
login-options.component.ts
...ial_code/angular/login-options/login-options.component.ts
+84
-0
No files found.
Documentation/Initial Prototype/src-gen/initial_code/angular/login-options/login-options.component.html
0 → 100644
View file @
1b1ebd13
<form
#
form=
"ngForm"
*
ngIf=
"noLoginUser"
>
<div
class=
"ui-g ui-fluid fixedtoolbar"
id=
"fixedtoolbar"
>
<div
class=
"ui-g-12 nopad"
>
<p-toolbar>
<div
class=
"ui-toolbar-center"
>
Login
</div>
</p-toolbar>
</div>
</div>
<div
class=
"fixedtoolbar-top-padding mobile-top-padding80"
>
<div
class=
"ui-g form-group"
>
<div
class=
"ui-g-12 ui-md-6 ui-md-offset-3 single-btn-container"
>
<p-button
icon=
"fa fa-linkedin"
(
onClick
)="
socicalMediaLogin
('
linkedIn
')"
label=
"Login with Linked In"
></p-button>
</div>
</div>
<div
class=
"ui-g form-group"
>
<div
class=
"ui-g-12 ui-md-6 ui-md-offset-3 single-btn-container"
>
<p-button
icon=
"fa fa-google"
(
onClick
)="
socicalMediaLogin
('
google
')"
label=
"Login with Google"
></p-button>
</div>
</div>
</div>
</form>
<p-progressSpinner
*
ngIf=
"showLoader"
></p-progressSpinner>
Documentation/Initial Prototype/src-gen/initial_code/angular/login-options/login-options.component.ts
0 → 100644
View file @
1b1ebd13
import
{
Component
,
OnDestroy
,
OnInit
}
from
'@angular/core'
;
import
{
ActivatedRoute
,
Router
}
from
'@angular/router'
;
import
{
Subscription
}
from
'rxjs/Subscription'
;
import
{
environment
}
from
'../../../environments/environment'
;
import
{
UserService
}
from
'../../oneit/services/user.service'
;
import
{
AppService
}
from
'./../../app.service'
;
import
{
UtilsService
}
from
'./../../oneit/services/utils.service'
;
@
Component
({
selector
:
'app-login-options'
,
templateUrl
:
'./login-options.component.html'
})
export
class
LoginOptionsComponent
implements
OnInit
,
OnDestroy
{
subscriptions
:
Array
<
Subscription
>
=
[];
showLoader
:
boolean
=
false
;
showLogoutMessage
:
boolean
=
false
;
noLoginUser
:
boolean
=
false
;
constructor
(
private
router
:
Router
,
private
activatedRoute
:
ActivatedRoute
,
private
appService
:
AppService
,
private
utilsService
:
UtilsService
,
private
userService
:
UserService
)
{
}
ngOnInit
()
{
this
.
showLoader
=
true
;
this
.
subscriptions
.
push
(
this
.
userService
.
reloadUserDetails
()
.
subscribe
(
data
=>
{
this
.
showLoader
=
false
;
const
userID
=
this
.
userService
.
getUserid
();
if
(
userID
!=
null
)
{
this
.
noLoginUser
=
false
;
this
.
router
.
navigate
([
'home'
]);
return
;
}
this
.
noLoginUser
=
true
;
}
)
);
this
.
activatedRoute
.
fragment
.
subscribe
((
fragment
:
string
)
=>
{
if
(
fragment
==
'logout'
)
{
this
.
showLogoutMessage
=
true
;
}
});
}
socicalMediaLogin
(
type
:
string
)
{
this
.
utilsService
.
clearErrorMessages
();
this
.
showLoader
=
true
;
const
params
=
{
environment
:
environment
.
envName
,
nextPage
:
window
.
location
.
href
.
split
(
'/#/'
)[
0
]
+
'/#/registration/'
+
type
};
const
svc
=
type
===
'linkedIn'
?
'LoginWithLinkedIn'
:
'LoginWithGoogle'
;
this
.
subscriptions
.
push
(
this
.
appService
.
socicalMediaLogin
(
svc
,
params
)
.
subscribe
(
data
=>
{
if
(
data
.
destination
)
{
this
.
showLoader
=
false
;
window
.
location
.
href
=
data
.
destination
;
return
;
}
},
error
=>
{
this
.
showLoader
=
false
;
this
.
utilsService
.
handleError
(
error
);
}
)
);
}
ngOnDestroy
()
{
this
.
utilsService
.
unsubscribeSubscriptions
(
this
.
subscriptions
);
}
}
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