Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
e-epal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Χάρης Παπαδόπουλος
e-epal
Commits
5a942732
Commit
5a942732
authored
Feb 19, 2017
by
Χάρης Παπαδόπουλος
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed storing loginInfo bug. Other tests
parent
bba5be41
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
30 deletions
+73
-30
drupal/modules/oauthost/src/Authentication/Provider/OAuthOSTConsumer.php
...oauthost/src/Authentication/Provider/OAuthOSTConsumer.php
+1
-1
source/components/home.ts
source/components/home.ts
+69
-23
source/store/logininfo/logininfo.reducer.ts
source/store/logininfo/logininfo.reducer.ts
+3
-6
No files found.
drupal/modules/oauthost/src/Authentication/Provider/OAuthOSTConsumer.php
View file @
5a942732
...
@@ -108,7 +108,7 @@ class OAuthOSTConsumer implements AuthenticationProviderInterface
...
@@ -108,7 +108,7 @@ class OAuthOSTConsumer implements AuthenticationProviderInterface
// Only check requests with the 'authorization' header starting with OAuth.
// Only check requests with the 'authorization' header starting with OAuth.
// drupal_set_message('sdfsddgdg');
// drupal_set_message('sdfsddgdg');
$oauthEnabled
=
$this
->
getHeader
(
$request
,
'
x
-oauth-enabled'
);
$oauthEnabled
=
$this
->
getHeader
(
$request
,
'
X
-oauth-enabled'
);
if
(
!
$oauthEnabled
&&
$request
->
getMethod
()
==
'POST'
)
{
if
(
!
$oauthEnabled
&&
$request
->
getMethod
()
==
'POST'
)
{
$oauthEnabled
=
$request
->
request
->
get
(
'X-oauth-enabled'
);
$oauthEnabled
=
$request
->
request
->
get
(
'X-oauth-enabled'
);
}
}
...
...
source/components/home.ts
View file @
5a942732
import
{
Router
,
ActivatedRoute
,
Params
}
from
'
@angular/router
'
;
import
{
Router
,
ActivatedRoute
,
Params
}
from
'
@angular/router
'
;
import
{
OnInit
,
Component
}
from
'
@angular/core
'
;
import
{
OnInit
,
Component
}
from
'
@angular/core
'
;
import
{
LoginInfoActions
}
from
'
../actions/logininfo.actions
'
;
import
{
LoginInfoActions
}
from
'
../actions/logininfo.actions
'
;
import
{
ILoginInfo
}
from
'
../store/logininfo/logininfo.types
'
;
import
{
NgRedux
,
select
}
from
'
ng2-redux
'
;
import
{
Observable
}
from
'
rxjs/Rx
'
;
import
{
IAppState
}
from
'
../store/store
'
;
import
{
import
{
FormBuilder
,
FormBuilder
,
FormGroup
,
FormGroup
,
...
@@ -12,38 +16,80 @@ import { AppSettings } from '../app.settings';
...
@@ -12,38 +16,80 @@ import { AppSettings } from '../app.settings';
selector
:
'
home
'
,
selector
:
'
home
'
,
template
:
`
template
:
`
<div>
<div>
<h4>Στοιχεία Σύνδεσης</h4>
<form [formGroup]="formGroup" method = "POST" action="http://eepal.dev/drupal/oauth/login" #form>
<form [formGroup]="formGroup" method = "POST" action="http://eepal.dev/drupal/oauth/login" #form>
<input type="hidden" name="X-oauth-enabled" value="true">
<input type="hidden" name="X-oauth-enabled" value="true">
<div *ngFor="let loginInfoToken$ of loginInfo$ | async; let i=index">
<div class="row">
<div class="row">
<div class="col-md-2 col-md-offset-5">
<div class="col-md-6">
{{loginInfoToken$.auth_token}}
</div>
<div class="col-md-6">
{{loginInfoToken$.auth_role}}
</div>
</div>
</div>
<div class="row">
<div *ngIf="!authToken" class="col-md-7 col-md-offset-5">
<button type="submit" class="btn-primary btn-lg pull-center" (click)="form.submit()">
<button type="submit" class="btn-primary btn-lg pull-center" (click)="form.submit()">
Είσοδος μέσω TaxisNet<span class="glyphicon glyphicon-menu-right"></span>
Είσοδος μέσω TaxisNet<span class="glyphicon glyphicon-menu-right"></span>
</button>
</button>
</div>
</div>
</div>
</div>
<div class="row">
<div *ngIf="authToken" class="col-md-7 col-md-offset-5">
<h3>Καλώς ήρθατε</h3>
</div>
</div>
<div class="row">
<div *ngIf="authToken" class="col-md-7 col-md-offset-5">
<input type="hidden" name="dologout" value="true">
<button type="submit" class="btn-primary btn-lg pull-center" (click)="form.submit()">
Αποσύνδεση<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
</div>
</form>
</form>
</div>
</div>
`
`
})
})
export
default
class
Home
implements
OnInit
{
export
default
class
Home
implements
OnInit
{
public
formGroup
:
FormGroup
;
public
formGroup
:
FormGroup
;
private
authToken
:
string
;
private
authRole
:
string
;
private
loginInfo$
:
Observable
<
ILoginInfo
>
;
constructor
(
private
fb
:
FormBuilder
,
constructor
(
private
fb
:
FormBuilder
,
private
_ata
:
LoginInfoActions
,
private
_ata
:
LoginInfoActions
,
private
activatedRoute
:
ActivatedRoute
)
{
private
_ngRedux
:
NgRedux
<
IAppState
>
,
private
activatedRoute
:
ActivatedRoute
)
{
this
.
authToken
=
''
;
this
.
authRole
=
''
;
this
.
formGroup
=
this
.
fb
.
group
({
this
.
formGroup
=
this
.
fb
.
group
({
Username
:
[],
Username
:
[],
Paswd
:
[]
Paswd
:
[]
});
});
};
};
ngOnInit
()
{
ngOnInit
()
{
this
.
loginInfo$
=
this
.
_ngRedux
.
select
(
state
=>
{
if
(
state
.
loginInfo
.
size
>
0
)
{
state
.
loginInfo
.
reduce
(({},
loginInfoToken
)
=>
{
this
.
authToken
=
loginInfoToken
.
auth_token
;
this
.
authRole
=
loginInfoToken
.
auth_role
;
return
loginInfoToken
;
},
{});
}
return
state
.
loginInfo
;
});
// subscribe to router event
// subscribe to router event
this
.
activatedRoute
.
queryParams
.
subscribe
((
params
:
Params
)
=>
{
this
.
activatedRoute
.
queryParams
.
subscribe
((
params
:
Params
)
=>
{
let
authToken
=
params
[
'
auth_token
'
];
this
.
authToken
=
params
[
'
auth_token
'
];
let
authRole
=
params
[
'
auth_role
'
];
this
.
authRole
=
params
[
'
auth_role
'
];
this
.
_ata
.
saveLoginInfo
({
auth_token
:
authToken
,
auth_role
:
authRole
});
if
(
this
.
authToken
&&
this
.
authRole
)
console
.
log
(
authToken
);
this
.
_ata
.
saveLoginInfo
({
auth_token
:
this
.
authToken
,
auth_role
:
this
.
authRole
});
// console.log(this.authToken);
});
});
}
}
...
@@ -53,4 +99,4 @@ export default class Home implements OnInit{
...
@@ -53,4 +99,4 @@ export default class Home implements OnInit{
checkvalidation
()
{
checkvalidation
()
{
}
}
}
}
source/store/logininfo/logininfo.reducer.ts
View file @
5a942732
...
@@ -10,12 +10,9 @@ export function loginInfoReducer(state: ILoginInfo = INITIAL_STATE, action): ILo
...
@@ -10,12 +10,9 @@ export function loginInfoReducer(state: ILoginInfo = INITIAL_STATE, action): ILo
switch
(
action
.
type
)
{
switch
(
action
.
type
)
{
case
LOGININFO_SAVE
:
case
LOGININFO_SAVE
:
let
loginInfoTokens
=
Array
<
ILoginInfoToken
>
();
let
loginInfoTokens
=
Array
<
ILoginInfoToken
>
();
let
ind
=
0
;
state
.
forEach
(
loginInfoToken
=>
{
loginInfoTokens
.
push
(
<
ILoginInfoToken
>
{
auth_token
:
action
.
payload
.
loginInfo
.
auth_token
,
auth_role
:
action
.
payload
.
loginInfo
.
auth_role
});
loginInfoTokens
.
push
(
<
ILoginInfoToken
>
{
auth_token
:
action
.
payload
.
loginInfo
.
auth_token
,
auth_role
:
action
.
payload
.
loginInfo
.
auth_role
});
ind
++
;
});
return
Seq
(
loginInfoTokens
).
map
(
n
=>
n
).
toList
();
return
Seq
(
loginInfoTokens
).
map
(
n
=>
n
).
toList
();
default
:
return
state
;
default
:
return
state
;
}
}
};
};
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