2 * Copyright (C) 2016, 2017 Roland Häder
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License as
6 * published by the Free Software Foundation, either version 3 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Affero General Public License for more details.
14 * You should have received a copy of the GNU Affero General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.jjobs.beans;
19 import java.io.Serializable;
20 import org.mxchange.jcoreee.bean.BaseBean;
21 import org.mxchange.jusercore.model.user.UserUtils;
24 * A general controller
26 * @author Roland Häder<roland@mxchange.org>
28 public abstract class BaseJobsController extends BaseBean implements Serializable {
33 private static final long serialVersionUID = 50_837_597_127_567_140L;
36 * Protected constructor
38 protected BaseJobsController () {
42 * Checks if given password is to weak to be used
44 * @param password Clear-text password
46 * @return Whether the entered password is to weak
48 protected boolean isWeakPassword (final String password) {
50 if (null == password) {
52 throw new NullPointerException("password is null"); //NOI18N
56 double passwordScore = UserUtils.calculatePasswordScore(password);
58 // Is the score within range?
59 boolean isWeak = (passwordScore <= this.getIntegerContextParameter("min_user_password_score")); //NOI18N