Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add help and profile urls to loginuserpass.php #61

Merged
merged 1 commit into from Apr 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -73,3 +73,8 @@ To debug the project in your IDE (such as NetBeans), do the following:
2. Run `make start enabledebug`.
3. Set your IDE to use debugger port 9000 and a Session ID of netbeans-xdebug.
4. Click the "Debug Project" button in your IDE.

### Manual Testing ###
1. Run `make`
1. Go to <http://localhost/module.php/core/authenticate.php?as=silauth> in
your browser.
8 changes: 6 additions & 2 deletions lib/Auth/Source/SilAuth.php
Expand Up @@ -21,7 +21,8 @@ class sspmod_silauth_Auth_Source_SilAuth extends sspmod_core_Auth_UserPassBase
protected $idBrokerConfig;
protected $mysqlConfig;
protected $recaptchaConfig;

protected $templateData;

/**
* Constructor for this authentication source.
*
Expand All @@ -39,7 +40,8 @@ public function __construct($info, $config)
$this->idBrokerConfig = ConfigManager::getConfigFor('idBroker', $config);
$this->mysqlConfig = ConfigManager::getConfigFor('mysql', $config);
$this->recaptchaConfig = ConfigManager::getConfigFor('recaptcha', $config);

$this->templateData = ConfigManager::getConfigFor('templateData', $config);

ConfigManager::initializeYii2WebApp(['components' => ['db' => [
'dsn' => sprintf(
'mysql:host=%s;dbname=%s',
Expand Down Expand Up @@ -70,6 +72,8 @@ public function authenticate(&$state)
*/
$state[self::AUTHID] = $this->authId;

$state['templateData'] = $this->templateData;

/* Save the $state-array, so that we can restore it after a redirect. */
$id = SimpleSAML_Auth_State::saveState($state, self::STAGEID);

Expand Down
3 changes: 3 additions & 0 deletions local.env.dist
Expand Up @@ -27,3 +27,6 @@ RECAPTCHA_SITE_KEY=
RECAPTCHA_SECRET=

COMPOSER_AUTH=

HELP_CENTER_URL=
PROFILE_URL=
2 changes: 2 additions & 0 deletions src/config/ssp-config.php
Expand Up @@ -16,4 +16,6 @@
'mysql.password' => Env::get('MYSQL_PASSWORD'),
'recaptcha.siteKey' => Env::get('RECAPTCHA_SITE_KEY'),
'recaptcha.secret' => Env::get('RECAPTCHA_SECRET'),
'templateData.profileUrl' => Env::get('PROFILE_URL'),
'templateData.helpCenterUrl' => Env::get('HELP_CENTER_URL'),
];
2 changes: 2 additions & 0 deletions www/loginuserpass.php
Expand Up @@ -79,6 +79,8 @@
$t->data['errorcode'] = $errorCode;
$t->data['errorparams'] = $errorParams;
$t->data['csrfToken'] = $csrfProtector->getMasterToken();
$t->data['profileUrl'] = $state['templateData']['profileUrl'] ?? '';
$t->data['helpCenterUrl'] = $state['templateData']['helpCenterUrl'] ?? '';

/* For simplicity's sake, don't bother telling this Request to trust any IP
* addresses. This is okay because we only track the failures of untrusted
Expand Down