Can't login because of quote (') in email address - joomla

Using LDAP to login.
If a user has quote ' in the email address, on login attempt getting this message:
please enter a valid email address
Cannot login.
If remove the quote manually in the DB, the message is gone.
Need to keep the quote in the email and be able to login.
Any ideas?

you will need to escape the email address.
i have not tested this but;
in administrator/components/com_login/models/login.php line 38 change
'username' => $input->$method->get('username', '', 'USERNAME'),
to
'username' => addslashes ( $input->$method->get('username', '', 'USERNAME') ),

Related

form_validation : error message array shows the default

I'm working on a form_validation. I have set the error messages, but it only shows the first error I've set. Other than that, it shows the default message.
$this->form_validation->set_rules('email','Email','required|valid_email|is_unique[user.email]',
array(
'required'=>'Empty email',
'is_unique[user.email]'=>'Email has been registered')
);
If I don't fill the email form, it shows 'Empty email'. If I write the email the same as in database, it shows the default error of CI : 'The Email field must contain a unique value.'
How I can show 'Email has been registered'?
Try:
$this->form_validation->set_rules('email','Email','required|valid_email|is_unique[user.email]',
array(
'required'=>'Empty email',
'is_unique'=>'Email has been registered')
);
DOCS: https://www.codeigniter.com/userguide3/libraries/form_validation.html#cascading-rules
I suspect you aren't getting the right error message because you shouldn't repeat user.email for the errors array.

Laravel email sending not working when 'to' not overridden

Email sending works fine when I have a global 'to' set in config/mail.php
'to' => [
'address' => 'someone#example.com',
'name' => 'Someone',
however as soon as this is removed and email is supposedly sent to the actual email address, nothing happens. No errors, everything appears fine, except the email is never received.
I've checked spam folders, I've tried sending to different email addresses, I've tried setting the notifiable route (even though 'email' exists on the model), I've cleared cache and config cache, I've tried listening to message sending event and dumping results - I'm lost.
solved.
When sending a MailableObject (as apposed to a MailMessage) you need to chain the 'to' command like so:
public function toMail($notifiable)
{
return (new MailObject(blah blah))->to($notifiable);
}

Laravel Mail the from and replyTo are ignored in the received email

I have problem with the Laravel's Mail. I have nothing wrong with the source code to send an email. The email was sent but the email address of sender is mine instead of sender. It is the one in the config file. The replyTo was ignored also.
My code is as following:
Mail::send('appointments.emails.new_appointment', ['data' => $data], function($message) use ($sender)
{
$message->from($sender['email'], $sender['name'])
->to('myemail#gmail.com', 'My Name')
->replyTo($sender['email'], $sender['name'])
->subject('Contact from ' . $sender['name']);
});
I received an email with sender name and my email address. And, when I click on rely, it replys to myself. That means the replyTo didn't work. How can I fix that?
Sorry if my English is not so good.

How to store birthday through mailchimp API?

I'm using mailchimp 1.3 in a Codeigniter application through this library.
I have this piece of code:
$birthday = date('m/d', strtotime('1984-04-29');
echo $birthday;
$merge_vars = array(
'FNAME'=> $profile_info['name'],
'LNAME'=> $profile_info['lastname'],
'birthday' => $birthday,
'GROUPINGS' => array(array('name' => $this->group_name, 'groups' => $this->group1))
);
$this->mail_chimp->listSubscribe($this->list_id, $email, $merge_vars);
The subscription works and in the administration panel of mailchimp I can see the user name and lastname, but no birthday.
In the api documentation it says it should be formatted as MM/DD and echoing the
birthday I verified it was right.
Any suggestions?
Ok, I solved.
I had to add a field for the birthday in the list settings as explained here:
http://kb.mailchimp.com/article/how-do-i-create-and-send-automatic-birthday-campaigns

Tank Auth: automatic login on email verification

I am using Tank Auth, and require my users validate their email addresses. Upon validation, users are still not logged in. I would like users to be automatically logged in when activating their account.
In my previous version (home-grown auth) I wrote a login function that didn't require a password, that was only callable in that situation. However, I can't see a way of doing that in Tank Auth. One solution would be to cache passwords until activation, but I really don't want to do that...
You can just bypass your login system.
Store either thier email address OR alias in a cookie.
when they activate grab the cookie, search(verify they exist) for the user, then setup a normal login session.
A login is just a set of session rules.
inside your activation script/email process, append
$this->_set_ac_cookie({email});
-
protected function _set_ac_cookie({email})
{
return $this->input->set_cookie(array(
'name' => 'ac_cookie_'.{email},
'expire' => '7200', //You may mirror when/if your activation key expires
'domain' => 'yourdomain.com',
'path' => '/'
));
}
check cookie exists
protected function _before_activation({email})
{
return $this->input->cookie('ac_cookie_'.{email})) ? TRUE : FALSE;
//make sure {email} has a UNIQUE db constraint
}
when the user clicks the activation link
if($this->_before_activation({email}))
{
//check user exists AND activation status === false (0)
//grab the user details from db based on {email}, set activation status to true (1)
//setup login session
$this->session->set_userdata(array(
'logged_in' => (int)1,
'user_id' => {user->id},
'alias' => {user->alias}
));
redirect('dashboard');
}
else
{
//sorry!
}
If you take a look at the code inside tank auth that handles the email activation, you'll see that it explicitly logs the user out on email verification.
https://github.com/ilkon/Tank-Auth/blob/master/application/controllers/auth.php
Line 243.
You could just comment out $this->tank_auth->logout(); on line 244 and it should work as you want it to, but this would be bad practice.

Resources