Laravel - Password forgotten -> Error DOMDocument::loadHTML(): Argument #1 ($source) must not be empty - email

I have a problem with Laravel 9.48.
When I go to Forgotten Password when logging in and enter my email address.
and then the button "Send Password Reset Link" I get the following error message.
DOMDocument::loadHTML(): Argument #1 ($source) must not be empty
Can you tell me how I can fix this problem?

Related

syntax error in replace expression for subject making in access

i am very new to expressions in access,
In my access data base i need to parse some fields into subject of the outlook when send mail button clicked in the form , for this i am using replace expression as below :
=Replace(Replace("Rework |1: Reason|2:Drawing Number|3","|1",Nz([Order_Number],"")),"|2",Nz([Reason_for_rework],"")),"|3",Nz([Drawing_Or_Mat_Number],""))
but for this i am getting error as :
"the 'emaildatabaseobject' macro action has an invalid value for the 'subject' argument
Kindly help me how to solve this
You syntax is completely off. You may have Choose in mind:
=Choose(YourCategoryID,Nz([Order_Number],""),Nz([Reason_for_rework],""),Nz([Drawing_Or_Mat_Number],""))

Validate the data from a Json File

I got this error message while trying to execute the get method.
Validation failed: Values not equal for element '$..userName', expected 'admin' but was '["admin",null,"HiCitrus","Unisys1","dscsc"]'
This is the script I have used:
http().client(todoClient)
.send()
.get("/rest/api/user/allusers")
.contentType("application/json");
http().client(todoClient)
.receive()
.response(HttpStatus.OK)
.messageType(MessageType.JSON)
// .validate(path, controlValue);
.validate("$..userName","admin");"
There are multiple parameters available for the username - is there a way to validate if I find the username "Admin"? Tried with the code below, but it's throwing an error.
.validate("$..userName",contains("admin"));

CakePHP 3 how to edit user without changing password (hashed)

I have my UsersController with my edit.ctp view. When I browse /users/edit/1, I see password field filled with ***** (filled with hash in entity User.php, using DefaultPasswordHasher). My UsersTable.php has password has required.
So, I can try:
unset($user->password); // in edit() from UsersController.php
and setting [require => false] in edit.ctp
When I save, I get
The user could not be saved. Please, try again.
Because in my UsersTable.php I have:
$validator
->requirePresence('password', 'create')
->notEmpty('password');
If I try to leave blank from controller I get error, if I try to fill with actual password, it hashes again.
How could I edit any user without change his password? Can I set this from model or I need to make password as not required?
I don't need show the real password to admins
I validate from controller for password_confirm (already works)
In add.ctp there is no problem because default value is always blank
I want to change password only if password field is filled
I suppose password needs to be required in Model because all users need their passwords, that's why I'm trying to keep it far from validation in controller
Validation says "on create" but even in update is needed, bug possible?
My cake version is 3.4.4
Thanks in advance
Couple of things:
Firstly, if you haven't already, you may want to mark the password field as hidden to prevent it from exposing the hash in toArray calls or JSON views.
Secondly, any data field provided to patchEntity will be validated and saved (as you've discovered), even if the value for the field is blank.
If you look at the entity with debug($user) you'll notice it tracks which fields are "dirty", and since patchEntity saw you submitted a password field (even if it was blank), it set the User entity's password to blank and marked it as "dirty". Even if you later call unset($user->password) it's still got a record of it being dirty, and so it'll attempt to validate a value for it.
You could potentially mark the field clean with $export->setDirty('password', false); but then when a new password was submitted in the form it wouldn't be saved.
A better option would be to check if the password field was blank before calling patchEntity, and unset it then:
if ($this->request->is(['patch', 'post', 'put'])) {
$data = $this->request->getData();
if(empty($data['password'])){
unset($data['password']);
}
$user = $this->Users->patchEntity($user, $data);

Add Custom Error messages in Sails Auth

{
"Error.Passport.Password.Invalid": "The provided password is invalid!",
"Error.Passport.Password.Wrong": "Whoa, that password wasn't quite right!",
"Error.Passport.Password.NotSet": "Oh no, you haven't set a password yet!",
"Error.Passport.Username.NotFound": "Uhm, what's your name again?",
"Error.Passport.User.Exists": "This username is already taken.",
"Error.Passport.Email.NotFound": "That email doesn't seem right",
"Error.Passport.Email.Missing": "You need to supply an email-address for verification",
"Error.Passport.Email.Exists": "This email already exists. So try logging in.",
"Error.Passport.Username.Missing": "You need to supply a username",
"Error.Passport.Password.Missing": "Oh no, you haven't set a password yet!",
"Error.Passport.Generic": "Snap. Something went wrong with authorization."
}
where do i need to add this error messages to show custom error messages in Sails Auth?
You have to add this on your localisation files under config/locales/{{lang}}.json
And restart server for reload locales files

Zend Validate, Display one message per validator

I am validating an email address using zend_validate_email.
For example, for email address aa#aa it throws several error messages including very technical describing that DNS mismatch (:S).
I am trying to make it display only 1 message that I want it to (for example: "Please enter a valid email").
Is there any way of doing it elegantly, apart from creating a subclass and overriding the isValid method, clearing out the array of error messages?
Thanks!
$validator = new Zend_Validate_EmailAddress();
// sets the message for all error types
$validator->setMessage('Please enter a valid email');
// sets the message for the INVALID_SEGMENT error
$validator->setMessage('Something with the part after the # is wrong', Zend_Validate_EmailAddress::INVALID_SEGMENT);
For a full list of errors and message templates see the Zend_Validate_EmailAddress class