Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public class AdminUserDAO implements IAdminUserDAO
private static final String SQL_QUERY_UPDATE_USERS_ROLE = "UPDATE core_user_role SET role_key = ? WHERE role_key = ?";
private static final String SQL_QUERY_SELECT_USER_ROLE = " SELECT id_user FROM core_user_role WHERE id_user = ? AND role_key = ? ";
private static final String SQL_QUERY_DELETE_ROLE_FOR_USER = " DELETE FROM core_user_role WHERE id_user = ? AND role_key = ? ";
private static final String SQL_QUERY_SELECT_USER_FROM_SEARCH = " SELECT id_user, access_code, last_name, first_name, email, status, locale, level_user, accessibility_mode "
private static final String SQL_QUERY_SELECT_USER_FROM_SEARCH = " SELECT id_user, access_code, last_name, first_name, email, status, locale, level_user, accessibility_mode, last_login "
+ " FROM core_admin_user WHERE access_code LIKE ? AND last_name LIKE ? AND email LIKE ? AND first_name LIKE ? ";
private static final String SQL_QUERY_SELECT_USERS_BY_RIGHT = " SELECT u.id_user , u.access_code, u.last_name , u.first_name, u.email, u.status, u.locale, u.level_user, u.accessibility_mode "
+ " FROM core_admin_user u INNER JOIN core_user_right r ON u.id_user = r.id_user WHERE r.id_right = ? ";
Expand Down Expand Up @@ -939,6 +939,13 @@ public Collection<AdminUser> selectUsersByFilter( AdminUserFilter auFilter )
user.setLocale( new Locale( daoUtil.getString( 7 ) ) );
user.setUserLevel( daoUtil.getInt( 8 ) );
user.setAccessibilityMode( daoUtil.getBoolean( 9 ) );

Timestamp dateLastLogin = daoUtil.getTimestamp( 10 );
if ( ( dateLastLogin != null ) && !dateLastLogin.equals( AdminUser.getDefaultDateLastLogin( ) ) )
{
user.setDateLastLogin( dateLastLogin );
}

userList.add( user );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,20 @@ manage_stylesheets.labelSortByMode=Sort the list according to a mode
manage_stylesheets.columnName=Name
manage_stylesheets.columnFilename=File Name
manage_stylesheets.buttonAdd=Add an XSL Stylesheet
manage_themes.title=G\u00e9rer les th\u00e8mes
manage_themes.labelName=Nom du th\u00e8me
manage_themes.labelDescription=Description
manage_themes.labelAuthor=Auteur
manage_themes.labelVersion=Version
manage_themes.buttonCreate=Cr\u00e9er un th\u00e8me
manage_themes.buttonEdit=Modifier
manage_themes.buttonDelete=Supprimer
manage_themes.buttonView=Voir les d\u00e9tails du th\u00e8me

# template create_stylesheet
create_stylesheet.title=Add an XSL Stylesheet
create_stylesheet.labelName=Name of the XSL Stylesheet
create_stylesheet.labelFilename=File
create_stylesheet.labelStyle=Style
create_stylesheet.labelMode=Mode
create_stylesheet.buttonCreate=Add the Stylesheet

# Template modify_stylesheet
modify_stylesheet.title=Modify an XSL Stylesheet
modify_stylesheet.labelName=Name of the XSL Stylesheet
modify_stylesheet.labelFilename=File
modify_stylesheet.labelStyle=Style
modify_stylesheet.labelMode=Mode
modify_stylesheet.buttonModify=Modify
modify_stylesheet.buttonView=View the code of the XSL file
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,3 @@ modify_stylesheet.labelStyle=Style
modify_stylesheet.labelMode=Mode
modify_stylesheet.buttonModify=Modifier
modify_stylesheet.buttonView=Consulter le code du fichier XSL


# Template manage_themes

6 changes: 6 additions & 0 deletions src/java/fr/paris/lutece/portal/web/PortalJspBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,12 @@ public String getError404Page( HttpServletRequest request )
*/
public String getError500Page( HttpServletRequest request, Throwable exception )
{
if ( exception == null )
{
AppLogService.error( "Error 500 : No exception provided" );
return getError500Page( request, (String) null );
}

if ( exception instanceof AppException )
{
// AppException calls AppLogService.error( message, this ) in the
Expand Down
2 changes: 1 addition & 1 deletion webapp/WEB-INF/templates/admin/admin_reset_password.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<@input type='password' name='confirm_new_password' id='confirm_new_password' placeHolder='${i18n("portal.users.modify_password_default_module.form.password.confirm")}' />
</@inputGroup>
</@formGroup>
<@formGroup labelKey='${i18n("portal.users.create_user.passwordComplexity")}' rows=2>
<@formGroup labelKey='${i18n("portal.users.create_user.passwordComplexity")}' labelFor='progress_bar_new_password' rows=2>
<@passwordComplexity id="progress_bar_new_password" inputId="new_password" />
</@formGroup>
<@formGroup class='text-center' rows=2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ Snippet:
<@passwordComplexity id='pwdComplexity' inputId='new_password' description='Password must contain at least 8 characters' />

-->
<#macro passwordComplexity id description='' params='' inputId='password' value='0' deprecated...>
<#macro passwordComplexity id description='' params='' inputId='password' value='0' >
<@deprecatedWarning args=deprecated />
<div class="progress"<#if params!=''> ${params}</#if>>
<div id="${id}" class="progress-bar progress-bar-striped" role="progressbar" style="width:0%">
<div id="complexity">0%</div>
</div>
<div class="lutece-progress-wrapper "<#if params!=''> ${params}</#if>>
<progress id="${id}" value="0" max="100" class="lutece-progress lutece-progress-danger"></progress>
<span id="${id}-text" class="lutece-progress-text">0%</span>
<div aria-live="polite" class="visually-hidden" id="${id}-status"></div>
<#if description!=''>
<span class="lutece-progress-description">${description}</span>
</#if>
</div>
<#if description!=''>
<span class="progress-description">${description}</span>
</#if>
<#if inputId!=''>
<script type="module">
import { LutecePassword } from './themes/shared/modules/lutecePassword.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,37 +63,35 @@
<@icon style='lock' />
</@inputGroupItem>
<@input type='password' id='first_password' name='first_password' maxlength=100 value='' size='' />
<@inputGroupItem type='text'>
<@link href='' class='input-group-link' title='#i18n{portal.admin.admin_login.forgotLogin}' id='lutece-password-toggler' >
<@icon style='eye' />
</@link>
<@inputGroupItem type='btn' pos='is-expanded'>
<@button type='button' title='#i18n{portal.admin.admin_login.passwordShow}' hideTitle=['all'] id='lutece-password-toggler' buttonIcon='eye' color='secondary' />
</@inputGroupItem>
<@inputGroupItem type='btn' pos='is-expanded'>
<@button type='button' id='generate_password' title='#i18n{portal.users.create_user.buttonLabelGeneratePassword}' hideTitle=['all'] buttonIcon='cog' size='' color='secondary' />
</@inputGroupItem>
</@inputGroup>
</@formGroup>
<@formGroup labelKey='#i18n{portal.users.create_user.labelSecondPassword}' labelFor='second_password' rows=2 helpKey='#i18n{portal.users.create_user.passwordComplexity}' mandatory=true>
<@formGroup labelKey='#i18n{portal.users.create_user.labelSecondPassword}' labelFor='second_password' rows=2 mandatory=true>
<@inputGroup>
<@inputGroupItem type='text'>
<@icon style='lock' />
</@inputGroupItem>
<@input type='password' id='second_password' name='second_password' maxlength=100 value='' size='' />
</@inputGroup>
</@formGroup>
<@formGroup rows=2>
<@formGroup labelKey='#i18n{portal.users.create_user.passwordComplexity}' labelFor='progress_bar_first_password' rows=2>
<@passwordComplexity id="progress_bar_first_password" inputId="first_password" />
</@formGroup>
<@div class='clearfix'></@div>
<@formGroup labelKey='#i18n{portal.users.create_user.labelNotify}' rows=2>
<@fieldSet legend='#i18n{portal.users.create_user.labelNotify}' legendClass='form-label' >
<#if default_user_notification = 1>
<@radioButton orientation='horizontal' labelKey='#i18n{portal.util.labelYes}' name='notify_user' value='1' checked=true />
<@radioButton orientation='horizontal' labelKey='#i18n{portal.util.labelNo}' name='notify_user' value='0' />
<#else>
<@radioButton orientation='horizontal' labelKey='#i18n{portal.util.labelYes}' name='notify_user' value='1' />
<@radioButton orientation='horizontal' labelKey='#i18n{portal.util.labelNo}' name='notify_user' value='0' checked=true />
</#if>
</@formGroup>
</@fieldSet>
</@fieldSet>
</@columns>
<@columns md=4 lg=3>
Expand Down
2 changes: 1 addition & 1 deletion webapp/WEB-INF/templates/admin/user/manage_users.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
</@manageFeatureItemColumn>
</#if>
</#list>
<#if user.dateLastLogin?? && user.dateLastLogin!=''>
<#if user.dateLastLogin?? && user.dateLastLogin?string!=''>
<@manageFeatureItemColumn>
<@p>#i18n{portal.users.manage_users.columnTitleDateLastLogin} : <strong>${user.dateLastLogin!}</strong></@p>
</@manageFeatureItemColumn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
</@columns>
</@row>
</@formGroup>

<@formGroup labelKey='#i18n{portal.users.create_user.passwordComplexity}' rows=2>
<@row>
<@columns xs=12 sm=6>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@
<@icon style='lock' />
</@inputGroupItem>
<@input type='password' name='first_password' id='first_password' params='autocomplete="off"' placeHolder='#i18n{portal.users.modify_password_default_module.form.password.new}' size=''/>
<@inputGroupItem type='text'>
<@link href='' class='input-group-link' title='#i18n{portal.admin.admin_login.passwordShow}' id='lutece-password-toggler' >
<@icon style='eye' />
</@link>
<@inputGroupItem type='btn' pos='is-expanded'>
<@button type='button' title='#i18n{portal.admin.admin_login.passwordShow}' hideTitle=['all'] id='lutece-password-toggler' buttonIcon='eye' color='secondary' />
</@inputGroupItem>
<@inputGroupItem type='btn' pos='is-expanded'>
<@button type='button' id='generate_password' title='#i18n{portal.users.create_user.buttonLabelGeneratePassword}' hideTitle=['all'] buttonIcon='cog' size='' color='secondary' />
Expand All @@ -48,7 +46,7 @@
<@input type='password' id='second_password' name='second_password' placeHolder='#i18n{portal.users.modify_password_default_module.form.password.confirm}' params='autocomplete="off" required="required"' size='' />
</@inputGroup>
</@formGroup>
<@formGroup labelKey='#i18n{portal.users.create_user.passwordComplexity}' rows=2>
<@formGroup labelKey='#i18n{portal.users.create_user.passwordComplexity}' labelFor='progress_bar_first_password' rows=2>
<@passwordComplexity id="progress_bar_first_password" inputId="first_password" />
</@formGroup>
<@formGroup>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion webapp/themes/admin/shared/css/portal_admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
@import url( partials/portal_site_admin.min.css );
@import url( partials/portal_portlet_admin.min.css );
@import url( partials/portal_insert_admin.min.css );
@import url( partials/portal_copy_admin.min.css );
@import url( partials/portal_copy_admin.min.css );
@import url( partials/portal_progress_admin.min.css );
2 changes: 1 addition & 1 deletion webapp/themes/admin/shared/css/portal_admin.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 23 additions & 8 deletions webapp/themes/shared/modules/lutecePassword.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ export class LutecePassword {
this.passTogglerBtn = '#lutece-password-toggler';
this.passTogglerIconOn = "ti-eye";
this.passTogglerIconOff = "ti-eye-off";
this.weakPasswords = ["123456", "123456789", "12345", "12345678", "1234", "111111", "1234567", "password"
, "123123", "qwerty", "abc123", "password1", "000000", "iloveyou", "123321", "qwertyuiop", "monkey", "dragon"
, "letmein", "football", "admin", "adminadmin", "welcome", "login", "princess", "solo", "passw0rd", "master"
, "sunshine", "shadow", "superman", "azerty", "azertyuiop", "qwerty123", "1q2w3e4r", "654321", "pokemon"
, "starwars", "batman", "trustno1", "hello", "freedom", "whatever", "baseball"];
}
/**
* Generates a new password that meets the following criteria:
Expand Down Expand Up @@ -62,6 +67,12 @@ export class LutecePassword {
* @returns {number} The complexity value of the password, as a percentage of the maximum score (100).
*/
calcComplexity(password) {

if (this.weakPasswords.includes(password))
{
return 5;
}

let hasLowercase = /[a-z]/.test(password);
let hasUppercase = /[A-Z]/.test(password);
let hasNumber = /\d/.test(password);
Expand All @@ -82,24 +93,28 @@ export class LutecePassword {
return Math.round(lengthScore + complexityScore);
}
/**
* Set the complexity bar
* Set the complexity bar
* Show the complexity result in progress bar.
*/
getComplexity( ) {
const input = document.querySelector( this.passwordInput )
const progressBar = document.querySelector( this.progressBar )
const progressBarText = document.querySelector( this.progressBar + "-text" )
const progressBarStatus = document.querySelector( this.progressBar + "-status" )
const label = progressBar.labels?.[0] || null;

input.addEventListener('input', () => {
const complexityScore = this.calcComplexity(input.value);
progressBar.style.width = complexityScore + '%';
progressBar.innerHTML = Math.round(complexityScore) + '%';
progressBar.setAttribute( 'aria-valuenow', Math.round( complexityScore ));
progressBar.classList.remove('bg-danger', 'bg-warning', 'bg-success');
progressBarText.textContent = Math.round(complexityScore) + "%";
progressBarStatus.textContent = (label?.textContent ?? '') + ' ' + Math.round(complexityScore) + "%";
progressBar.value = complexityScore;
progressBar.classList.remove('lutece-progress-danger', 'lutece-progress-warning', 'lutece-progress-success');
if( complexityScore < 50 ) {
progressBar.classList.add('bg-danger')
progressBar.classList.add('lutece-progress-danger')
} else if ( complexityScore >= 50 && complexityScore < 100 ) {
progressBar.classList.add('bg-warning')
progressBar.classList.add('lutece-progress-warning')
} else {
progressBar.classList.add('bg-success')
progressBar.classList.add('lutece-progress-success')
}
});
}
Expand Down