Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Σταύρος Παπαδάκης
e-epal
Commits
5a942732
Commit
5a942732
authored
Feb 19, 2017
by
Χάρης Παπαδόπουλος
Browse files
fixed storing loginInfo bug. Other tests
parent
bba5be41
Changes
3
Hide whitespace changes
Inline
Side-by-side
drupal/modules/oauthost/src/Authentication/Provider/OAuthOSTConsumer.php
View file @
5a942732
...
...
@@ -108,7 +108,7 @@ class OAuthOSTConsumer implements AuthenticationProviderInterface
// Only check requests with the 'authorization' header starting with OAuth.
// drupal_set_message('sdfsddgdg');
$oauthEnabled
=
$this
->
getHeader
(
$request
,
'
x
-oauth-enabled'
);
$oauthEnabled
=
$this
->
getHeader
(
$request
,
'
X
-oauth-enabled'
);
if
(
!
$oauthEnabled
&&
$request
->
getMethod
()
==
'POST'
)
{
$oauthEnabled
=
$request
->
request
->
get
(
'X-oauth-enabled'
);
}
...
...
source/components/home.ts
View file @
5a942732
import
{
Router
,
ActivatedRoute
,
Params
}
from
'
@angular/router
'
;
import
{
OnInit
,
Component
}
from
'
@angular/core
'
;
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
{
FormBuilder
,
FormGroup
,
...
...
@@ -9,48 +13,90 @@ import {
}
from
'
@angular/forms
'
;
import
{
AppSettings
}
from
'
../app.settings
'
;
@
Component
({
selector
:
'
home
'
,
template
:
`
selector
:
'
home
'
,
template
:
`
<div>
<h4>Στοιχεία Σύνδεσης</h4>
<form [formGroup]="formGroup" method = "POST" action="http://eepal.dev/drupal/oauth/login" #form>
<input type="hidden" name="X-oauth-enabled" value="true">
<div *ngFor="let loginInfoToken$ of loginInfo$ | async; let i=index">
<div class="row">
<div class="col-md-6">
{{loginInfoToken$.auth_token}}
</div>
<div class="col-md-6">
{{loginInfoToken$.auth_role}}
</div>
</div>
</div>
<div class="row">
<div class="col-md-2 col-md-offset-5">
<div *ngIf="!authToken" class="col-md-7 col-md-offset-5">
<button type="submit" class="btn-primary btn-lg pull-center" (click)="form.submit()">
Είσοδος μέσω TaxisNet<span class="glyphicon glyphicon-menu-right"></span>
</button>
</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>
</div>
`
})
export
default
class
Home
implements
OnInit
{
public
formGroup
:
FormGroup
;
constructor
(
private
fb
:
FormBuilder
,
private
_ata
:
LoginInfoActions
,
private
activatedRoute
:
ActivatedRoute
)
{
this
.
formGroup
=
this
.
fb
.
group
({
export
default
class
Home
implements
OnInit
{
public
formGroup
:
FormGroup
;
private
authToken
:
string
;
private
authRole
:
string
;
private
loginInfo$
:
Observable
<
ILoginInfo
>
;
constructor
(
private
fb
:
FormBuilder
,
private
_ata
:
LoginInfoActions
,
private
_ngRedux
:
NgRedux
<
IAppState
>
,
private
activatedRoute
:
ActivatedRoute
)
{
this
.
authToken
=
''
;
this
.
authRole
=
''
;
this
.
formGroup
=
this
.
fb
.
group
({
Username
:
[],
Paswd
:
[]
});
};
Paswd
:
[]
});
};
ngOnInit
()
{
// subscribe to router event
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
this
.
activatedRoute
.
queryParams
.
subscribe
((
params
:
Params
)
=>
{
let
authToken
=
params
[
'
auth_token
'
];
let
authRole
=
params
[
'
auth_role
'
];
this
.
_ata
.
saveLoginInfo
({
auth_token
:
authToken
,
auth_role
:
authRole
});
console
.
log
(
authToken
);
this
.
authToken
=
params
[
'
auth_token
'
];
this
.
authRole
=
params
[
'
auth_role
'
];
if
(
this
.
authToken
&&
this
.
authRole
)
this
.
_ata
.
saveLoginInfo
({
auth_token
:
this
.
authToken
,
auth_role
:
this
.
authRole
});
// console.log(this.authToken);
});
}
});
}
checkvalidation
()
{
checkvalidation
()
{
}
}
}
source/store/logininfo/logininfo.reducer.ts
View file @
5a942732
...
...
@@ -10,12 +10,9 @@ export function loginInfoReducer(state: ILoginInfo = INITIAL_STATE, action): ILo
switch
(
action
.
type
)
{
case
LOGININFO_SAVE
:
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
});
ind
++
;
});
loginInfoTokens
.
push
(
<
ILoginInfoToken
>
{
auth_token
:
action
.
payload
.
loginInfo
.
auth_token
,
auth_role
:
action
.
payload
.
loginInfo
.
auth_role
});
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