Skip to content

Commit

Permalink
Merge branch 'develop' into feature/ssp2-loginuserpass-twig
Browse files Browse the repository at this point in the history
  • Loading branch information
briskt committed Jun 28, 2024
2 parents b9885e3 + 2b36ad0 commit 60d562d
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 41 deletions.
1 change: 1 addition & 0 deletions features/bootstrap/MfaContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,7 @@ public function iShouldSeeAPromptForAManagerRescueCode()
$pageHtml = $page->getHtml();
Assert::assertContains('Ask Your Recovery Contact for Help', $pageHtml);
Assert::assertContains('Enter code', $pageHtml);
Assert::assertContains('m*****r@e******.c**', $pageHtml);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions modules/expirychecker/src/Auth/Process/ExpiryDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,7 @@ public function redirect2PasswordChange(
string $passwordChangeUrl,
string $change_pwd_session,
int $expiryTimestamp
): void
{
): void {
$sessionType = 'expirychecker';
/* Save state and redirect. */
$state['expiresAtTimestamp'] = $expiryTimestamp;
Expand Down
21 changes: 14 additions & 7 deletions modules/expirychecker/src/Utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ public static function getUrlDomain(string $in_url, string $start_marker = '//',
*
* Returns 1 if the domains of the two urls are the same and 0 otherwise.
*/
public static function haveSameDomain(string $url1, string $start_marker1,
string $end_marker1, string $url2, string $start_marker2 = '//',
string $end_marker2 = '/'): int
{
public static function haveSameDomain(
string $url1,
string $start_marker1,
string $end_marker1,
string $url2,
string $start_marker2 = '//',
string $end_marker2 = '/'
): int {
$domain1 = self::getUrlDomain($url1, $start_marker1, $end_marker1);
$domain2 = self::getUrlDomain($url2, $start_marker2, $end_marker2);

Expand All @@ -53,9 +57,12 @@ public static function haveSameDomain(string $url1, string $start_marker1,
* for apex to use. If the domains of the change password url and the
* original url are different, it appends the StateId to the output.
*/
public static function convertOriginalUrl(string $passwordChangeUrl,
string $originalUrlParam, string $originalUrl, string $stateId): string
{
public static function convertOriginalUrl(
string $passwordChangeUrl,
string $originalUrlParam,
string $originalUrl,
string $stateId
): string {
$sameDomain = self::haveSameDomain($passwordChangeUrl,
'//', '/', $originalUrl, '//', '/');
$original = $originalUrlParam . ":" . urlencode($originalUrl);
Expand Down
4 changes: 2 additions & 2 deletions modules/material/themes/material/default/header.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

{% if not (analyticsTrackingId ?? null) is empty %}
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ trackingId }}"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id={{ analyticsTrackingId }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
Expand All @@ -17,7 +17,7 @@
gtag('js', new Date());
gtag('config', '{{ trackingId }}');
gtag('config', '{{ analyticsTrackingId }}');
</script>
{% endif %}

Expand Down
18 changes: 9 additions & 9 deletions modules/material/themes/material/default/selectidp-links.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
const idpInput = document.createElement('input');
idpInput.type = 'hidden';
idpInput.name = '{{ returnIDParam|e }}';
idpInput.name = '{{ returnIDParam|e('js')|raw }}';
idpInput.value = id;
document.querySelector('form').appendChild(idpInput);
Expand Down Expand Up @@ -39,7 +39,7 @@

{% if not helpCenterUrl ?? '' is empty %}
<nav class="mdl-navigation">
<a href="{{ helpCenterUrl }}" target="_blank" rel="noopener" class="mdl-navigation__link">
<a href="{{ helpCenterUrl|e(html_attr) }}" target="_blank" rel="noopener" class="mdl-navigation__link">
{{ '{selectidp-links:help}'|trans }}
</a>
</nav>
Expand All @@ -51,9 +51,9 @@
{% include 'announcement.twig' %}

<form layout-children="row" child-spacing="space-around">
<input type="hidden" name="entityID" value="{{ entityID|e }}"/>
<input type="hidden" name="return" value="{{ return|e }}"/>
<input type="hidden" name="returnIDParam" value="{{ returnIDParam|e }}"/>
<input type="hidden" name="entityID" value="{{ entityID|e('html_attr') }}"/>
<input type="hidden" name="return" value="{{ return|e('html_attr') }}"/>
<input type="hidden" name="returnIDParam" value="{{ returnIDParam|e('html_attr') }}"/>

{% for idp in idplist %}
<div
Expand All @@ -63,14 +63,14 @@
<div class="mdl-card__media white-bg fixed-height">
<button
class="mdl-button logo-container fill-parent"
onclick="setSelectedIdp('{{ idp.entityid|e }}')"
name="idp_{{ idp.entityid }}"
onclick="setSelectedIdp('{{ idp.entityid|e('js')|raw }}')"
name="idp_{{ idp.entityid|e('html_attr') }}"
>
<div class="image-wrapper">
<img
class="logo"
id="{{ idp.entityid|e }}"
src="{{ idp.iconurl is defined ? idp.iconurl : 'default-logo.png' }}"
id="{{ idp.entityid|e('html_attr') }}"
src="{{ idp.iconurl is defined ? idp.iconurl|e('html_attr') : 'default-logo.png' }}"
>
</div>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<div class="mdl-card__title center">
<p class="mdl-card__subtitle-text">
{{ '{mfa:manager_sent}'|trans({'{managerEmail': managerEmail}) }}
{{ '{mfa:manager_sent}'|trans({'%managerEmail%': managerEmail}) }}
</p>
</div>

Expand Down Expand Up @@ -60,7 +60,7 @@

<div class="mdl-card__actions" layout-children="row">
<span flex></span>
<button name="submitMfa" class="mdl-button mdl-button--raised mdl-button--primary">
<button name="submitMfa" type="submit" class="mdl-button mdl-button--raised mdl-button--primary">
{{ '{mfa:button_verify}'|trans }}
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

<div class="mdl-card__actions" layout-children="row">
<span flex></span>
<button name="submitMfa" class="mdl-button mdl-button--raised mdl-button--primary">
<button name="submitMfa" type="submit" class="mdl-button mdl-button--raised mdl-button--primary">
{{ '{mfa:button_verify}'|trans }}
</button>
</div>
Expand Down
15 changes: 5 additions & 10 deletions modules/mfa/src/Auth/Process/Mfa.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,7 @@ public static function validateMfaSubmission(
LoggerInterface $logger,
string $mfaType,
string $rpOrigin
): string
{
): string {
if (empty($mfaId)) {
return 'No MFA ID was provided.';
} elseif (empty($employeeId)) {
Expand Down Expand Up @@ -709,8 +708,7 @@ public static function isRememberMeCookieValid(
string $expireDate,
array $mfaOptions,
array $state
): bool
{
): bool {
$rememberSecret = Env::requireEnv('REMEMBER_ME_SECRET');
if (!empty($cookieHash) && !empty($expireDate) && is_numeric($expireDate)) {
// Check if value of expireDate is in future
Expand All @@ -736,8 +734,7 @@ public static function generateRememberMeCookieString(
string $employeeId,
int $expireDate,
array $mfaOptions
): string
{
): string {
$allMfaIds = '';
foreach ($mfaOptions as $opt) {
if ($opt['type'] !== 'manager') {
Expand All @@ -764,8 +761,7 @@ protected static function redirectToLowOnBackupCodesNag(
array &$state,
string $employeeId,
int $numBackupCodesRemaining
): void
{
): void {
$state['employeeId'] = $employeeId;
$state['numBackupCodesRemaining'] = (string)$numBackupCodesRemaining;

Expand Down Expand Up @@ -807,8 +803,7 @@ public static function setRememberMeCookies(
string $employeeId,
array $mfaOptions,
string $rememberDuration = '+30 days'
): void
{
): void {
$rememberSecret = Env::requireEnv('REMEMBER_ME_SECRET');
$secureCookie = Env::get('SECURE_COOKIE', true);
$expireDate = strtotime($rememberDuration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ public static function isRateLimitBlockingAnyOfThese(array $ipAddresses): bool
public static function recordFailedLoginBy(
array $ipAddresses,
LoggerInterface $logger
): void
{
): void {
foreach ($ipAddresses as $ipAddress) {
$newRecord = new FailedLoginIpAddress(['ip_address' => strtolower($ipAddress)]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ public static function isCaptchaRequiredFor(?string $username): bool
public static function recordFailedLoginBy(
string $username,
LoggerInterface $logger
): void
{
): void {
$newRecord = new FailedLoginUsername(['username' => strtolower($username)]);
if (!$newRecord->save()) {
$logger->critical(json_encode([
Expand Down
3 changes: 1 addition & 2 deletions modules/silauth/src/Auth/Source/saml/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ public static function convertToSamlFieldNames(
?string $managerEmail,
string $profileReview,
array $member
): array
{
): array {

// eduPersonUniqueId (only alphanumeric allowed)
$alphaNumericUuid = str_replace('-', '', $uuid);
Expand Down
3 changes: 1 addition & 2 deletions modules/silauth/src/Auth/Source/tests/fakes/FakeIdBroker.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public function __construct(
string $accessToken,
LoggerInterface $logger,
string $idpDomainName = 'fake.example.com'
)
{
) {
parent::__construct(
$baseUri,
$accessToken,
Expand Down

0 comments on commit 60d562d

Please sign in to comment.