@@ -0,0 +1,2577 @@
+/*%0A * Copyright (c) 2009, 2010, 2011, 2012, 2013, B3log Team%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A/*%0A * To change this template, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0Apackage org.b3log.solo.util;%0A%0Aimport java.util.Random;%0A%0A/**%0A * Generate a random string, %3Cp%3E whose length is also random between 8 and 16.%0A *%0A * @author %3Ca href=%22mailto:echowdx@gmail.com%22%3EDongxu Wang%3C/a%3E%0A * @version 1.0.0.0, Mar 11, 2013%0A */%0Apublic class RandomString %7B%0A%0A    /**%0A     * String's length should be positive.%0A     */%0A    private static final int LEN_LIM = 1;%0A    /**%0A     * String's length maximum limit.%0A     */%0A    private static final int MAX_LEN = 16;%0A    /**%0A     * String's length minimum limit.%0A     */%0A    private static final int MIN_LEN = 8;%0A    /**%0A     * String's random length.%0A     */%0A    private static final int RANDOM_LEN = new Random()%0A            .nextInt(MAX_LEN - MIN_LEN + LEN_LIM) + MIN_LEN;%0A    /**%0A     * Characters set table, can be extended.%0A     */%0A    private final char%5B%5D table;%0A    /**%0A     * String's random seed.%0A     */%0A    private final Random random = new Random();%0A    /**%0A     * String's random characters buffer.%0A     */%0A    private final char%5B%5D buf;%0A%0A    /**%0A     * Generate a random string with a random length %5B8, 16%5D.%0A     */%0A    public RandomString() %7B%0A        this(RANDOM_LEN);%0A    %7D%0A%0A    /**%0A     * Generate a random string with given length.%0A     *%0A     * @param length string's length%0A     */%0A    public RandomString(final int length) %7B%0A        if (length %3C LEN_LIM) %7B%0A            throw new IllegalArgumentException(%22length %3C 1: %22 + length);%0A        %7D%0A        table = %220123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ%22%0A                .toCharArray();%0A        buf = new char%5Blength%5D;%0A    %7D%0A%0A    /**%0A     * Generate next random string.%0A     *%0A     * @return next random string%0A     */%0A    public String nextString() %7B%0A        for (int idx = 0; idx %3C buf.length; ++idx) %7B%0A            buf%5Bidx%5D = table%5Brandom.nextInt(table.length)%5D;%0A        %7D%0A        return new String(buf);%0A    %7D%0A%7D%0A

Add a feature, by which user can find their lost password by registered email. see issue #200