Commit 322adb91 authored by Xavier Guimard's avatar Xavier Guimard

Merge

parents 1979ac09 91ffd295
......@@ -166,7 +166,7 @@ sub _reset {
elsif ( $self->conf->{requireToken} ) {
unless ( $self->ott->getToken($token) ) {
$self->setSecurity($req);
$self->userLogger->warn('Reset try with expired/bas token');
$self->userLogger->warn('Reset try with expired/bad token');
return PE_TOKENEXPIRED;
}
}
......@@ -385,11 +385,12 @@ sub changePwd {
$self->userLogger->error('User tries to change password without token');
return PE_NOTOKEN;
}
unless ( delete $req->sessionInfo->{pwdAllowed} ) {
$self->userLogger->error(
'User tries to use another token to change a password');
return PE_NOTOKEN;
}
# unless ( delete $req->sessionInfo->{pwdAllowed} ) {
# $self->userLogger->error(
# 'User tries to use another token to change a password');
# return PE_NOTOKEN;
# }
# Check if user wants to generate the new password
if ( $req->param('reset') ) {
......@@ -490,7 +491,7 @@ sub display {
my ( $self, $req ) = @_;
$self->logger->debug( 'Display called with code: ' . $req->error );
my %tplPrm = (
SKIN_PATH => '/static',
SKIN_PATH => $self->conf->{staticPrefix},
SKIN => $self->p->getSkin($req),
SKIN_BG => $self->conf->{portalSkinBackground},
MAIN_LOGO => $self->conf->{portalMainLogo},
......@@ -573,6 +574,13 @@ sub display {
$tplPrm{DISPLAY_PASSWORD_FORM} = 1;
}
# Display password change form again if passwords mismatch
elsif ( $req->error == PE_PASSWORDFORMEMPTY )
{
$self->logger->debug('Display password form');
$tplPrm{DISPLAY_PASSWORD_FORM} = 1;
}
# Custom template parameters
if ( my $customParams = $self->p->customParameters ) {
foreach ( keys %$customParams ) {
......
......@@ -200,7 +200,7 @@
"scope":"Scope",
"selectIdP":"اختر موفر الهوية الخاص بك",
"service":"Service",
"sendPwd":"أرسل لي كلمة مرور جديدة",
"sendPwd":"Send me a link",
"serverError":"يحدث خطأ في الخادم",
"serviceProvidedBy":"الخدمة المقدمة من قبل",
"sessionsDeleted":"الجلسات التالية تم غلقها",
......
......@@ -200,7 +200,7 @@
"scope":"Scope",
"selectIdP":"Wähle deinen Identitätsanbieter aus",
"service":"Dienst",
"sendPwd":"Sende mir ein neues Passwort",
"sendPwd":"Send me a link",
"serverError":"Ein Fehler ist aufgetreten",
"serviceProvidedBy":"Dienst angeboten von",
"sessionsDeleted":"Die folgenden Sitzungen wurden geschlossen",
......
......@@ -200,7 +200,7 @@
"scope": "Scope",
"selectIdP":"Select your Identity Provider",
"service":"Service",
"sendPwd":"Send me a new password",
"sendPwd":"Send me a link",
"serverError":"Error occurs on the server",
"serviceProvidedBy":"Service provided by",
"sessionsDeleted":"The following sessions have been closed",
......
......@@ -200,7 +200,7 @@
"scope":"Scope",
"selectIdP":"Select your Identity Provider",
"service":"Service",
"sendPwd":"Send me a new password",
"sendPwd":"Send me a link",
"serverError":"Error occurs on the server",
"serviceProvidedBy":"Service provided by",
"sessionsDeleted":"The following sessions have been closed",
......
......@@ -200,7 +200,7 @@
"scope": "Informations",
"selectIdP":"Choisissez votre fournisseur d'identité",
"service":"Service",
"sendPwd":"Envoyez-moi un nouveau mot de passe",
"sendPwd":"Envoyez-moi un lien",
"serverError":"Une erreur est survenue sur le serveur",
"serviceProvidedBy":"Ce service est fourni par",
"sessionsDeleted":"Les sessions suivantes ont été fermées",
......
......@@ -200,7 +200,7 @@
"scope":"Scope",
"selectIdP":"Seleziona il tuo provider di identità",
"service":"Servizio",
"sendPwd":"Inviami una nuova password",
"sendPwd":"Send me a link",
"serverError":"Un, errore si verifica sul server",
"serviceProvidedBy":"Servizio offerto da",
"sessionsDeleted":"Le sessioni seguenti sono state chiuse",
......
......@@ -200,7 +200,7 @@
"scope":"Scope",
"selectIdP":"Select your Identity Provider",
"service":"Service",
"sendPwd":"Send me a new password",
"sendPwd":"Send me a link",
"serverError":"Error occurs on the server",
"serviceProvidedBy":"Service provided by",
"sessionsDeleted":"The following sessions have been closed",
......
......@@ -200,7 +200,7 @@
"scope":"Scope",
"selectIdP":"Select your Identity Provider",
"service":"Service",
"sendPwd":"Send me a new password",
"sendPwd":"Send me a link",
"serverError":"Error occurs on the server",
"serviceProvidedBy":"Service provided by",
"sessionsDeleted":"The following sessions have been closed",
......
......@@ -200,7 +200,7 @@
"scope":"Scope",
"selectIdP":"Select your Identity Provider",
"service":"Service",
"sendPwd":"Send me a new password",
"sendPwd":"Send me a link",
"serverError":"Error occurs on the server",
"serviceProvidedBy":"Service provided by",
"sessionsDeleted":"The following sessions have been closed",
......
......@@ -200,7 +200,7 @@
"scope":"Scope",
"selectIdP":"Chọn bộ cung cấp danh tính của bạn",
"service":"Service",
"sendPwd":"Gửi cho tôi một mật khẩu mới",
"sendPwd":"Send me a link",
"serverError":"Lỗi xảy ra trên máy chủ",
"serviceProvidedBy":"Dịch vụ được cung cấp bởi",
"sessionsDeleted":"Các phiên làm việc sau đã được đóng lại",
......
......@@ -11,14 +11,14 @@ BEGIN {
}
my ( $res, $user, $pwd );
my $maintests = 14;
my $maintests = 16;
my $mailSend = 0;
my $mail2 = 0;
SKIP: {
eval
'require Email::Sender::Simple;use GD::SecurityImage;use Image::Magick;';
'require Email::Sender::Simple;use GD::SecurityImage;use Image::Magick;';
if ($@) {
skip 'Missing dependencies', $maintests;
}
......@@ -30,11 +30,11 @@ SKIP: {
$dbh->do(
'CREATE TABLE users (user text,password text,name text, mail text)');
$dbh->do(
"INSERT INTO users VALUES ('yadd','yadd','Yadd','yadd\@badwolf.org')");
"INSERT INTO users VALUES ('yadd','yadd','Yadd','yadd\@badwolf.org')"
);
my $client = LLNG::Manager::Test->new(
{
ini => {
{ ini => {
logLevel => 'error',
useSafeJail => 1,
portalDisplayRegister => 1,
......@@ -61,6 +61,18 @@ SKIP: {
}
);
ok( $res = $client->_post(
'/',
IO::String->new('user=yadd&password=yadd&test=sql'),
length => 32
),
'Auth query'
);
expectOK($res);
my $id = expectCookie($res);
$client->logout($id);
foreach my $sameBrowser ( 0 .. 1 ) {
# Test form
......@@ -72,8 +84,7 @@ SKIP: {
$query = 'mail=yadd%40badwolf.org';
# Post email
ok(
$res = $client->_post(
ok( $res = $client->_post(
'/resetpwd', IO::String->new($query),
query => 'test=sql',
length => length($query),
......@@ -81,21 +92,21 @@ SKIP: {
),
'Post mail'
);
my $pdata = 'lemonldappdata=' . expectCookie( $res, 'lemonldappdata' );
my $pdata
= 'lemonldappdata=' . expectCookie( $res, 'lemonldappdata' );
ok( mail() =~ m#a href="http://auth.example.com/resetpwd\?(.*?)"#,
'Found link in mail' );
$query = $1;
ok(
$res = $client->_get(
ok( $res = $client->_get(
'/resetpwd',
query => $query,
accept => 'text/html',
( $sameBrowser ? ( cookie => $pdata ) : () ),
),
'Post mail token received by mail with '
. ( $sameBrowser ? 'the same browser' : 'another browser' )
. ( $sameBrowser ? 'the same browser' : 'another browser' )
);
( $host, $url, $query ) = expectForm( $res, '#', undef, 'token' );
ok( $res->[2]->[0] =~ /newpassword/s, ' Ask for a new password' );
......@@ -104,8 +115,7 @@ SKIP: {
$pdata = 'lemonldappdata=' . expectCookie( $res, 'lemonldappdata' );
# Post new password
ok(
$res = $client->_post(
ok( $res = $client->_post(
'/resetpwd', IO::String->new($query),
length => length($query),
accept => 'text/html',
......@@ -118,6 +128,18 @@ SKIP: {
#print STDERR Dumper($query);
}
ok( $res = $client->_post(
'/', IO::String->new('user=yadd&password=zz&test=sql'),
length => 30
),
'Auth query'
);
expectOK($res);
$id = expectCookie($res);
$client->logout($id);
}
eval { unlink 't/userdb.db' };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment