Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
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
PSDI Army
yii2
Commits
011c6c14
Commit
011c6c14
authored
Dec 31, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #1713.
parent
97859791
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
21 deletions
+22
-21
redirect.php
extensions/yii/authclient/views/redirect.php
+3
-4
Choice.php
extensions/yii/authclient/widgets/Choice.php
+19
-17
No files found.
extensions/yii/authclient/views/redirect.php
View file @
011c6c14
...
@@ -7,10 +7,10 @@ use yii\helpers\Json;
...
@@ -7,10 +7,10 @@ use yii\helpers\Json;
/* @var $enforceRedirect boolean */
/* @var $enforceRedirect boolean */
$redirectJavaScript
=
<<<EOL
$redirectJavaScript
=
<<<EOL
function popupWindowRedirect(url, enforceRedirect
= true
) {
function popupWindowRedirect(url, enforceRedirect) {
if (window.opener) {
if (window.opener) {
window.close();
window.close();
if (enforceRedirect) {
if (enforceRedirect
=== undefined || enforceRedirect
) {
window.opener.location = url;
window.opener.location = url;
}
}
} else {
} else {
...
@@ -35,4 +35,4 @@ $redirectJavaScript .= 'popupWindowRedirect(' . Json::encode($url) . ', ' . Json
...
@@ -35,4 +35,4 @@ $redirectJavaScript .= 'popupWindowRedirect(' . Json::encode($url) . ', ' . Json
document
.
getElementById
(
'link'
).
style
.
display
=
'none'
;
document
.
getElementById
(
'link'
).
style
.
display
=
'none'
;
</script>
</script>
</body>
</body>
</html>
</html>
\ No newline at end of file
extensions/yii/authclient/widgets/Choice.php
View file @
011c6c14
...
@@ -18,8 +18,9 @@ use yii\authclient\ClientInterface;
...
@@ -18,8 +18,9 @@ use yii\authclient\ClientInterface;
* to get auth clients information.
* to get auth clients information.
*
*
* Example:
* Example:
* ~~~
*
* <?= yii\authclient\Choice::widget([
* ~~~php
* <?= yii\authclient\widgets\Choice::widget([
* 'baseAuthUrl' => ['site/auth']
* 'baseAuthUrl' => ['site/auth']
* ]); ?>
* ]); ?>
* ~~~
* ~~~
...
@@ -28,8 +29,8 @@ use yii\authclient\ClientInterface;
...
@@ -28,8 +29,8 @@ use yii\authclient\ClientInterface;
* along with using method {@link clientLink()} or {@link createClientUrl()}.
* along with using method {@link clientLink()} or {@link createClientUrl()}.
* For example:
* For example:
*
*
* ~~~
* ~~~
php
* <?php $authChoice = yii\authclient\Choice::beginWidget([
* <?php $authChoice = yii\authclient\
widgets\
Choice::beginWidget([
* 'baseAuthUrl' => ['site/auth']
* 'baseAuthUrl' => ['site/auth']
* ]); ?>
* ]); ?>
* <ul>
* <ul>
...
@@ -37,7 +38,7 @@ use yii\authclient\ClientInterface;
...
@@ -37,7 +38,7 @@ use yii\authclient\ClientInterface;
* <li><?= $authChoice->clientLink($client); ?></li>
* <li><?= $authChoice->clientLink($client); ?></li>
* <?php endforeach; ?>
* <?php endforeach; ?>
* </ul>
* </ul>
* <?php yii\authclient\Choice::endWidget(); ?>
* <?php yii\authclient\
widgets\
Choice::endWidget(); ?>
* ~~~
* ~~~
*
*
* @see \yii\authclient\AuthAction
* @see \yii\authclient\AuthAction
...
@@ -51,27 +52,19 @@ use yii\authclient\ClientInterface;
...
@@ -51,27 +52,19 @@ use yii\authclient\ClientInterface;
class
Choice
extends
Widget
class
Choice
extends
Widget
{
{
/**
/**
* @var ClientInterface[] auth providers list.
*/
private
$_clients
;
/**
* @var string name of the auth client collection application component.
* @var string name of the auth client collection application component.
* This component will be used to fetch services value if it is not set.
* This component will be used to fetch services value if it is not set.
*/
*/
public
$clientCollection
=
'authClientCollection'
;
public
$clientCollection
=
'authClientCollection'
;
/**
/**
* @var array configuration for the external clients base authentication URL.
*/
private
$_baseAuthUrl
;
/**
* @var string name of the GET param , which should be used to passed auth client id to URL
* @var string name of the GET param , which should be used to passed auth client id to URL
* defined by
{@link baseAuthUrl}
.
* defined by
[[baseAuthUrl]]
.
*/
*/
public
$clientIdGetParamName
=
'authclient'
;
public
$clientIdGetParamName
=
'authclient'
;
/**
/**
* @var array the HTML attributes that should be rendered in the div HTML tag representing the container element.
* @var array the HTML attributes that should be rendered in the div HTML tag representing the container element.
*/
*/
public
$
mainContainerHtmlO
ptions
=
[
public
$
o
ptions
=
[
'class'
=>
'auth-clients'
'class'
=>
'auth-clients'
];
];
/**
/**
...
@@ -85,6 +78,15 @@ class Choice extends Widget
...
@@ -85,6 +78,15 @@ class Choice extends Widget
public
$autoRender
=
true
;
public
$autoRender
=
true
;
/**
/**
* @var array configuration for the external clients base authentication URL.
*/
private
$_baseAuthUrl
;
/**
* @var ClientInterface[] auth providers list.
*/
private
$_clients
;
/**
* @param ClientInterface[] $clients auth providers
* @param ClientInterface[] $clients auth providers
*/
*/
public
function
setClients
(
array
$clients
)
public
function
setClients
(
array
$clients
)
...
@@ -212,8 +214,8 @@ class Choice extends Widget
...
@@ -212,8 +214,8 @@ class Choice extends Widget
ChoiceAsset
::
register
(
$view
);
ChoiceAsset
::
register
(
$view
);
$view
->
registerJs
(
"
\$
('#"
.
$this
->
getId
()
.
"').authchoice();"
);
$view
->
registerJs
(
"
\$
('#"
.
$this
->
getId
()
.
"').authchoice();"
);
}
}
$this
->
mainContainerHtmlO
ptions
[
'id'
]
=
$this
->
getId
();
$this
->
o
ptions
[
'id'
]
=
$this
->
getId
();
echo
Html
::
beginTag
(
'div'
,
$this
->
mainContainerHtmlO
ptions
);
echo
Html
::
beginTag
(
'div'
,
$this
->
o
ptions
);
}
}
/**
/**
...
...
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