Skip to content

Commit

Permalink
Merge pull request #4 from SlateFoundation/develop
Browse files Browse the repository at this point in the history
Release v1.0.0.rc-1
  • Loading branch information
nbey authored Sep 8, 2020
2 parents 694d823 + e1783a7 commit 2ac225f
Show file tree
Hide file tree
Showing 11 changed files with 355 additions and 124 deletions.
5 changes: 1 addition & 4 deletions .holo/branches/emergence-site/_emergence-saml2.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
[holomapping]
files = [
"*/**",
"!php-config/Git.config.d/"
]
files = "**"
5 changes: 1 addition & 4 deletions .holo/branches/emergence-site/_skeleton-v2.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[holomapping]
files = [
"**",
"!php-config/Git.config.d/*"
]
files = "**"
before = "*"
2 changes: 1 addition & 1 deletion .holo/sources/skeleton-v2.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[holosource]
url = "https://github.com/JarvusInnovations/emergence-skeleton-v2"
ref = "refs/tags/v2.4.2"
ref = "refs/tags/v2.4.4"

[holosource.project]
holobranch = "emergence-skeleton"
17 changes: 12 additions & 5 deletions event-handlers/Site/beforeScriptExecute/hub-token-session.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
use Firebase\JWT\JWT;

use Slate\NetworkHub\School;
use Slate\NetworkHub\SchoolUser;
use Slate\NetworkHub\User;

$hubToken = $_REQUEST['hub_token'];

if (!empty($hubToken)) {
if (!empty($_REQUEST['hub_token'])) {
$hubToken = $_REQUEST['hub_token'];
list($header, $payload, $signature) = explode('.', $hubToken);
$decodedPayload = json_decode(base64_decode($payload), true);

Expand All @@ -21,9 +21,16 @@
return RequestHandler::throwInvalidRequestError('hub_token is invalid. Please retry the request or contact an administrator if the issue persists.');
}

$NetworkUser = User::getByUsername($decodedPayload['user']['PrimaryEmail']);
// error out if user can not be found with decoded email
if (!$NetworkUser = User::getByField('Email', $decodedPayload['user']['PrimaryEmail'])) {
return RequestHandler::throwInvalidRequestError('hub_token is invalid. Please retry the request or contact an administrator if the issue persists.');
}

if (!$NetworkUser || $NetworkUser->SchoolID !== $NetworkSchool->ID) {
// error out if user is not associated with network school
if (!$SchoolUser = SchoolUser::getByWhere([
'PersonID' => $NetworkUser->ID,
'SchoolID' => $NetworkSchool->ID
])) {
return RequestHandler::throwInvalidRequestError('hub_token is invalid. Please retry the request or contact an administrator if the issue persists.');
}

Expand Down
15 changes: 14 additions & 1 deletion html-templates/connectors/network-hub/createJob.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@
</p>
</fieldset>

<fieldset>
<legend>Network Schools</legend>
{foreach from=\Slate\NetworkHub\School::getAll() item=School}
<p>
<label>
{$School->Handle} ({$School->Domain})
<input type="checkbox" name="schools[{$School->Handle}]" value="true" {refill field=schools[$School->Handle] checked="true" default="false"}>
</label>
</p>
{/foreach}
</fieldset>


<fieldset>
<legend>User Accounts</legend>
<p>
Expand All @@ -54,4 +67,4 @@

<input type="submit" value="Synchronize">
</form>
{/block}
{/block}
22 changes: 19 additions & 3 deletions html-templates/login/login.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{extends "designs/site.tpl"}

{block "content"}
<h2>Log in to {Slate::$schoolName}</h2>
<h2>Log in to {$.Site.title|escape}</h2>
{if $authException}
<div class="notify error">
<strong>Sorry!</strong> {$authException->getMessage()}
Expand All @@ -18,7 +18,7 @@
{if $localLoginFlow}
{$formAttribs = ''}
{else}
{$formAttribs = cat('action="/connectors/network-hub/login"', $returnUrl)}
{$formAttribs = 'action="/connectors/network-hub/login"'}
{/if}

<form method="POST" class="login-form" {$formAttribs}>
Expand All @@ -39,7 +39,23 @@
{loginField}
{passwordField}
{else}
{field inputName=email label="Email Address" required=true attribs='autofocus autocapitalize="none" autocorrect="off" spellcheck="false"' hint='Log in with your SLATE email address.'}
{field
inputName=email
label="Email Address"
required=true
attribs='autofocus autocapitalize="none" autocorrect="off" spellcheck="false"'
hint='Log in with your SLATE email address.'
default=$.request.email
}

{if !empty($Schools)}
<select name="SchoolHandle">
<option value="">Select One</option>
{foreach from=$Schools item=School}
<option value="{$School->Handle}">{$School->Domain}</option>
{/foreach}
</select>
{/if}
{/if}

<div class="submit-area">
Expand Down
Loading

0 comments on commit 2ac225f

Please sign in to comment.