Forbidding user name and email change

Mehr
1 Monat 2 Wochen her #194430 von Jmantysalo
How can I forbid users to change their username and email address? Would it make sense to have a global option for this?

I think this is a small security issue in bigger installations where accounts are made automatically and are not of the form firstname_lastname: a user can change name and email so that he/she will appear to be different person.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

LimeSurvey Partners
Mehr
1 Monat 2 Wochen her #194446 von DenisChenu
User name : what for ? Nor related to security in my opinion ?
Logi is already update disable.

About email : by plugin in my opinion. Not add again and again and again and again a new settings ....

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 2 Wochen her #194450 von Jmantysalo
A plugin would be good idea, but I think there is no event that could be used for that.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 2 Wochen her #194453 von DenisChenu
beforeUserSave, but there are a lack of isValid update.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 2 Wochen her #194455 von Jmantysalo
Where is beforeUserSave documented? At least not listed in manual.limesurvey.org/Plugin_events

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 2 Wochen her #194456 von DenisChenu

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 2 Wochen her #194457 von Jmantysalo
OK, thanks. Now, how to disable the change? At least return false; and $this->getEvent()->set('success', false); did not work.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 2 Wochen her #194460 von DenisChenu

DenisChenu schrieb: but there are a lack of isValid update.

You can make a feature request please.


BUT : you can reset value.

1. get the model with $model = $this->getEvent()->get('model');
2. Check if isNewrecord www.yiiframework.com/doc/api/1.1/CActive...d#isNewRecord-detail
3. if not reset previous value ($his->email=User::model()->getByPk($model->getPrimaryKey())->getAttribute('email');

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 2 Wochen her #194463 von Jmantysalo
I don't quite get this. I tested with

$iUserid = Permission::getUserId();
$model = $this->getEvent()->get('model');
$oUser = User::model()->findByPk($iUserid);
$oUser->email = "just-a-test@test";

and I think it should change anybodys email to just-a-test@test when trying to make any change. But it seems to do nothing.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 2 Wochen her #194464 von DenisChenu
This work for me

public function beforeUserSave()
{
$user = $this->getEvent()->get('model');
$user->email = "Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!";
}


With your code : you update current user ....

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 2 Wochen her #194467 von Jmantysalo
Thanks, now I got this to work. Here is the code snippet:

$user = $this->getEvent()->get('model');
if ($user->isNewRecord) {
// Nothing, setting the name and email for a new user.
return;
}
// Revert to old email address and full name.
$iUserid = Permission::getUserId();
$oUser = User::model()->findByPk($iUserid);
$user->email = $oUser->email;
$user->full_name = $oUser->full_name;

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 2 Wochen her #194484 von DenisChenu
Please : think have a isValid allowed update still better :)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha