Forgot password?
Welcome to our site!
Or Join with FTTF

Is Registry->Viewer->save() calling \Lampcms\Mongo\Doc save()?


Hi Dmitri,
Can the Viewer be a User object?
Just trying to work out why the following doesn't seem to be saving the users password.

* Update ['pwd'] in Viewer object and save object
* @return object $this
protected function saveNewPassword()
$this->email = $this->Registry->Viewer['email'];
$this->username = $this->Registry->Viewer['username'];
$this->newPwd = $this->Request['pwd1'];

$this->Registry->Viewer['pwd'] = String::hashPassword($this->newPwd);

return $this;

The Changepwd controller is extending the Resetpwd controller, and wondering why the Changepwd controller can't use the Resetpwd 'savePassword()' instead?

Forgive me if I'm way off base here, trying hard to get my head around it all.

asked June 10, 2013 at 12:40 AM


1 Answer

Best answer
Yes, Viewer is the User object.
We call it Viewer to indicate that it represents the User who is currently viewing the page. It can be logged in user or a non-logged in guest user.

The reason for calling the user "Viewer" is to differentiate it from just any registered user. For example when you viewing someone's profile or when you following/unfollowing another user we would refer to that other user as "User" but you are a "Viewer" which is also a user.

I did not invent this terminology. I first saw it on some Google's API and I liked the idea.

Anyway, a Viewer is a User and User extends MongoDoc.

If you need help in debugging something you can always add new logging line anywhere in the script.

For example
d("new password is: ".$this->newPassword);

The d() function means debug-level logging. It will work only in debug mode and only when you configured the logging (path to log) in !config.ini properly.
answered June 11, 2013 at 5:16 AM
ahhh kewl, Just thinking.... Maybe we could extend lampCMS to include a wiki? This would be a great place to start some documentation using choice answers like this that explain certain features. We'd also be able to use it for our application users as a go too, how too type of thing :)
Jun 12, 2013 02:38 AM

Your answer

Join with account you already have