Auto gen password for __PUBLIC__ and hide fields
parent
36e33b3215
commit
99bcc90c03
|
@ -291,9 +291,16 @@ class UserController extends AbstractController
|
||||||
|
|
||||||
// always validate password for new users,
|
// always validate password for new users,
|
||||||
// but only validate it for existing users when they change it.
|
// but only validate it for existing users when they change it.
|
||||||
if ($user_id == 0 || ($user_id > 0 && $clean['password'] != '')) {
|
if (($user_id == 0 || ($user_id > 0 && $clean['password'] != '')) && $clean['user_name'] != '__PUBLIC__') {
|
||||||
$user_validator->password($clean['password'], $clean['password_repeat']);
|
$user_validator->password($clean['password'], $clean['password_repeat']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auto generate password for __PUBLIC__ user
|
||||||
|
if ($clean['user_name'] === '__PUBLIC__') {
|
||||||
|
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*_";
|
||||||
|
$clean['password'] = substr(str_shuffle($chars), 0, 24);
|
||||||
|
}
|
||||||
|
|
||||||
if ($user_id > 0) {
|
if ($user_id > 0) {
|
||||||
$user_validator->userId($user_id);
|
$user_validator->userId($user_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ $().ready(function () {
|
||||||
}
|
}
|
||||||
$('#label').focus();
|
$('#label').focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#type").change(function () {
|
$("#type").change(function () {
|
||||||
switch ($("select#type option:checked").val()) {
|
switch ($("select#type option:checked").val()) {
|
||||||
case "website":
|
case "website":
|
||||||
|
@ -103,6 +104,21 @@ $("select#popular_ports").change(function () {
|
||||||
}
|
}
|
||||||
}).change();
|
}).change();
|
||||||
|
|
||||||
|
$("#user_name").change(function ()
|
||||||
|
{
|
||||||
|
switch ($("#user_name").val()) {
|
||||||
|
case "__PUBLIC__":
|
||||||
|
$('#password').parent().slideUp();
|
||||||
|
$('#password_repeat').parent().slideUp();
|
||||||
|
$("select#level").val('30');
|
||||||
|
$("#name").val('Public page');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$('#password').parent().slideDown();
|
||||||
|
$('#password_repeat').parent().slideDown();
|
||||||
|
}
|
||||||
|
}).change();
|
||||||
|
|
||||||
|
|
||||||
function psm_xhr(mod, params, method, on_complete, options) {
|
function psm_xhr(mod, params, method, on_complete, options) {
|
||||||
method = (typeof method === 'undefined') ? 'GET' : method;
|
method = (typeof method === 'undefined') ? 'GET' : method;
|
||||||
|
|
Loading…
Reference in New Issue