Skip to content
This repository has been archived by the owner on Sep 19, 2022. It is now read-only.

Commit

Permalink
WIp
Browse files Browse the repository at this point in the history
  • Loading branch information
vyskocilpavel committed Aug 20, 2021
1 parent a65403f commit cfe94b7
Show file tree
Hide file tree
Showing 30 changed files with 336 additions and 438 deletions.
10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ All notable changes to this project will be documented in this file.
## [v1.0.0]
- First release

[Unreleased]: https://github.com/CESNET/lshostel-aai-proxy-idp-template/tree/master
[v1.3.0]: https://github.com/CESNET/lshostel-aai-proxy-idp-template/tree/v1.3.0
[v1.2.0]: https://github.com/CESNET/lshostel-aai-proxy-idp-template/tree/v1.2.0
[v1.1.0]: https://github.com/CESNET/lshostel-aai-proxy-idp-template/tree/v1.1.0
[v1.0.0]: https://github.com/CESNET/lshostel-aai-proxy-idp-template/tree/v1.0.0
[Unreleased]: https://github.com/CESNET/lsaai-aai-proxy-idp-template/tree/master
[v1.3.0]: https://github.com/CESNET/lsaai-aai-proxy-idp-template/tree/v1.3.0
[v1.2.0]: https://github.com/CESNET/lsaai-aai-proxy-idp-template/tree/v1.2.0
[v1.1.0]: https://github.com/CESNET/lsaai-aai-proxy-idp-template/tree/v1.1.0
[v1.0.0]: https://github.com/CESNET/lsaai-aai-proxy-idp-template/tree/v1.0.0
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# lshostel-aai-proxy-idp-template
# lsaai-aai-proxy-idp-template

[![Latest Stable Version](https://poser.pugx.org/bbmri/simplesamlphp-module-lshostel/v/stable)](https://packagist.org/packages/bbmri/simplesamlphp-module-lshostel)
[![Latest Unstable Version](https://poser.pugx.org/bbmri/simplesamlphp-module-lshostel/v/unstable)](https://packagist.org/packages/bbmri/simplesamlphp-module-lshostel)
[![CodeFactor](https://www.codefactor.io/repository/github/cesnet/lshostel-aai-proxy-idp-template/badge)](https://www.codefactor.io/repository/github/cesnet/lshostel-aai-proxy-idp-template)
[![License](https://poser.pugx.org/bbmri/simplesamlphp-module-lshostel/license)](https://packagist.org/packages/bbmri/simplesamlphp-module-lshostel)
[![Latest Stable Version](https://poser.pugx.org/bbmri/simplesamlphp-module-lsaai/v/stable)](https://packagist.org/packages/bbmri/simplesamlphp-module-lsaai)
[![Latest Unstable Version](https://poser.pugx.org/bbmri/simplesamlphp-module-lsaai/v/unstable)](https://packagist.org/packages/bbmri/simplesamlphp-module-lsaai)
[![CodeFactor](https://www.codefactor.io/repository/github/cesnet/lsaai-aai-proxy-idp-template/badge)](https://www.codefactor.io/repository/github/cesnet/lsaai-aai-proxy-idp-template)
[![License](https://poser.pugx.org/bbmri/simplesamlphp-module-lsaai/license)](https://packagist.org/packages/bbmri/simplesamlphp-module-lsaai)

Template for LifeScience Hostel AAI Proxy IdP component

## Instalation
`php composer.phar require bbmri/simplesamlphp-module-lshostel`
`php composer.phar require bbmri/simplesamlphp-module-lsaai`
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"require": {
"simplesamlphp/composer-module-installer": "~1.0",
"simplesamlphp/simplesamlphp": "~1.17",
"cesnet/simplesamlphp-module-perun": "~5.0"
"cesnet/simplesamlphp-module-perun": "~6.0"
}
}
8 changes: 4 additions & 4 deletions config-examples/module_lshostel.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php

/**
* This is example configuration fot LSHostel module.
* This is example configuration fot lsaai module.
* Copy this file to default config directory and edit the properties.
*
* copy command (from SimpleSAML base dir)
* cp modules/lshostel/module_lshostel.php config/
* cp modules/lsaai/module_lsaai.php config/
*/
$config = [
'register_link' => '',

'pwd_reset' => [
'lshostel_entity_id' => '',
'lshostel_scope' => '',
'lsaai_entity_id' => '',
'lsaai_scope' => '',
'vo_short_name' => '',
'perun_namespace' => '',
'perun_url' => '',
Expand Down
26 changes: 26 additions & 0 deletions dictionaries/lsaai.definition.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"error_report_email_message": {
"en": "Please provide your mail so that we can contact you for further information or let you know the issue was fixed."
},
"user_pass_header": {
"en": "Life Science Hostel Login"
},
"user_pass_text": {
"en": "Enter your email and password"
},
"register_acc_hostel": {
"en": "Sign up"
},
"email": {
"en": "Email"
},
"forgot_password": {
"en": "Forgotten password"
},
"title_WRONGUSERPASS": {
"en": "Incorrect email or password"
},
"descr_WRONGUSERPASS": {
"en": "Either no user with this email could be found, or the password you gave was wrong. Please check the email and try again."
}
}
6 changes: 3 additions & 3 deletions lib/Auth/Process/LoginModify.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace SimpleSAML\Module\lshostel\Auth\Process;
namespace SimpleSAML\Module\lsaai\Auth\Process;

use SimpleSAML\Auth\ProcessingFilter;
use SimpleSAML\Error\Exception;
Expand Down Expand Up @@ -29,7 +29,7 @@ public function __construct($config, $reserved)

if (!isset($config['loginAttrName'])) {
throw new Exception(
"lshostel:LoginModify missing mandatory configuration option 'loginAttrName'."
"lsaai:LoginModify missing mandatory configuration option 'loginAttrName'."
);
}

Expand All @@ -47,7 +47,7 @@ public function process(&$request)
$userName = $userNameParts[0] . '_' . strtolower($userNameParts[1]);

$request['Attributes'][$this->loginAttrName][0] = $userName;
Logger::debug("lshostel:LoginModify - Modified " . $oldUserName . " to new format " . $userName);
Logger::debug("lsaai:LoginModify - Modified " . $oldUserName . " to new format " . $userName);
}

}
143 changes: 75 additions & 68 deletions templates/pwd_reset-tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
}
?>

<link rel="stylesheet" type="text/css" href="<?php echo SimpleSAML\Module::getModuleUrl('lshostel/res/bootstrap/css/bootstrap.min.css'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo SimpleSAML\Module::getModuleUrl('lshostel/res/css/lshostel.css'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo SimpleSAML\Module::getModuleUrl('lsaai/res/bootstrap/css/bootstrap.min.css'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo SimpleSAML\Module::getModuleUrl('lsaai/res/css/lsaai.css'); ?>" />

<meta name="robots" content="noindex, nofollow" />

Expand Down Expand Up @@ -97,77 +97,84 @@

<div id="wrap">

<div id="content">
<div id="content" class="content">
<div class="row pl-0 pr-0">
<div class="col-sm-6 logo-wrap col-align--center">
<img src="<?php echo SimpleSAML\Module::getModuleUrl('lshostel/res/img/lshostel_256.png'); ?>" alt="Life Science Hostel logo">
<div class="col-md-6 col-md-offset-3 logo-wrap col-align--center">
<img src="<?php echo SimpleSAML\Module::getModuleUrl('lsaai/res/img/ls_logo.png'); ?>" alt="Life Science Hostel logo">
</div>
<div class="col-sm-6">
<div class="col-md-6 col-md-offset-3">
<?php
echo "<h1> " . $this->t('{lshostel:pwd_reset:header}') . "</h1>";
$userName = "";
if (isset($_POST['username'])) {
$userName = $_POST['username'];
try {
if (!$_POST['passwordResetOk']) {
sendPasswordResetEmail($userName);
$_POST['passwordResetOk'] = true;
unset($_POST['username']);
}
?>
<div class="alert alert-success" >
<p>
<span class="glyphicon glyphicon-exclamation-sign" style="float:left; font-size: 38px; margin-right: 10px;"></span>
<strong><?php echo $this->t('{lshostel:pwd_reset:ok_header}');?></strong>
</p>
<p><?php echo $this->t('{lshostel:pwd_reset:ok_text}');?></p>
</div>

<?php
} catch (\Exception $exception) {
?>
<div class="alert alert-danger" >
<span class="glyphicon glyphicon-exclamation-sign" style="float:left; font-size: 38px; margin-right: 10px;"></span>
<strong><?php echo $this->t('{lshostel:pwd_reset:err_header}');?></strong>
<p><?php echo $this->t('{lshostel:pwd_reset:err_text_part1}');?></p>
<p><?php echo $this->t('{lshostel:pwd_reset:err_text_part2}');?>
<a href="<?php echo $config->getString('technicalcontact_email'); ?>"><?php echo $this->t('{lshostel:pwd_reset:support}');?></a>.
</p>
</div>

<?php
}
}

if (!$_POST['passwordResetOk']) {
?>

<p><?php echo $this->t('{lshostel:pwd_reset:text}'); ?></p>

<br>

<form action="" method="post" name="passwd_reset" class="form-horizontal">
<div class="form-group">
<label class="sr-only" for="inlineFormInputGroup"><?php echo $this->t('{{lshostel:pwd_reset:email}'); ?></label>
<div class="input-group mb-2">
<span class="input-group-addon" id="basic-addon1">@</span>
<input id="username" type="email" name="username" class="form-control" value="<?php echo $userName; ?>" placeholder="Email" aria-describedby="basic-addon1"/>
</div>
</div>

<div class="form-group">
<button class="btn btn-success btn-block" type="submit">
<?php echo $this->t('{lshostel:pwd_reset:submit}'); ?>
</button>
</div>
</form>

<?php
}
?>
echo "<h1> " . $this->t('{lsaai:pwd_reset:header}') . "</h1>";
$userName = "";
if (isset($_POST['username'])) {
$userName = $_POST['username'];
try {
if (!$_POST['passwordResetOk']) {
sendPasswordResetEmail($userName);
$_POST['passwordResetOk'] = true;
unset($_POST['username']);
}
?>
<div class="alert alert-success" >
<p>
<span class="glyphicon glyphicon-exclamation-sign" style="float:left; font-size: 38px; margin-right: 10px;"></span>
<strong><?php echo $this->t('{lsaai:pwd_reset:ok_header}');?></strong>
</p>
<p><?php echo $this->t('{lsaai:pwd_reset:ok_text}');?></p>
</div>

<?php
} catch (\Exception $exception) {
$emailAddress = $config->getString('technicalcontact_email');
if (!str_starts_with("mailto:", $emailAddress)) {
$emailAddress = "mailto:" . $emailAddress;
}

?>
<div class="alert alert-danger" >
<span class="glyphicon glyphicon-exclamation-sign" style="float:left; font-size: 38px; margin-right: 10px;"></span>
<strong><?php echo $this->t('{lsaai:pwd_reset:err_header}');?></strong>
<p><?php echo $this->t('{lsaai:pwd_reset:err_text_part1}');?></p>
<p><?php echo $this->t('{lsaai:pwd_reset:err_text_part2}');?>
<a href="<?php echo $emailAddress ?>"><?php echo $this->t('{lsaai:pwd_reset:support}');?></a>.
</p>
</div>

<?php
}
}

if (!$_POST['passwordResetOk']) {
?>

<p><?php echo $this->t('{lsaai:pwd_reset:text}'); ?></p>

<br>

<form action="" method="post" name="passwd_reset" class="form-horizontal">
<div class="form-group">
<label class="sr-only" for="inlineFormInputGroup"><?php echo $this->t('{{lsaai:pwd_reset:username}'); ?></label>
<div class="input-group mb-2">
<span class="input-group-addon" >
<span class=" glyphicon glyphicon-user" id="basic-addon1"></span>
</span>
<input id="username" name="username" class="form-control" value="<?php echo $userName ?>" placeholder="Username" aria-describedby="basic-addon1"/>
</div>
</div>

<div class="form-group">
<button class="btn btn-success btn-block" type="submit">
<?php echo $this->t('{lsaai:pwd_reset:submit}'); ?>
</button>
</div>
</form>

<?php
}
?>
</div>

<?php
<?php



Expand Down
Loading

0 comments on commit cfe94b7

Please sign in to comment.