benedmunds / CodeIgniter-Ion-Auth

Simple and Lightweight Auth System for CodeIgniter
http://benedmunds.com/ion_auth/
MIT License
2.34k stars 1.14k forks source link

Controllers\Auth Line: 583 $this->data['message'] = $this->validation->getErrors() ? ..... #1508

Closed moutlou closed 3 years ago

moutlou commented 3 years ago

PLease fix it to return empty string. When there aren't erros it returning a string with length = 134. We need preg_match or trim to check if is empty or not. Otherwise you can add a variable like me

$this->data['hasErrors'] = $this->validation->getErrors() ? true : false ;

Thank you for this great library Ben.

benedmunds commented 3 years ago

Hey, the Validation library is a part of CI, not Ion Auth.

moutlou commented 3 years ago

But the variable $message is yours Ben. You are creating this var in the $data. İ didnt check but it musnt have 134 spaces , İ think.

Web Developer & Software Engineer

Kimden: Ben Edmunds @.***>Gönderildi: 2 Nisan 2021 Cuma 02:35Kime: benedmunds/CodeIgniter-Ion-AuthBilgi: Moutlou; AuthorKonu: Re: [benedmunds/CodeIgniter-Ion-Auth] Controllers\Auth Line: 583 $this->data['message'] = $this->validation->getErrors() ? ..... (#1508) Hey, the Validation library is a part of CI, not Ion Auth.

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.

benedmunds commented 3 years ago

Sorry, I'm not quite following. Is this as issue with what validation->getErrors() is returning into $data['message']? Which version of Ion Auth and CI are you using?

moutlou commented 3 years ago

Ben, when there aren’t errors it not returning an empty string but a string with 134 spaces.

From: Ben Edmunds @.> Sent: Friday, April 2, 2021 6:11 PM To: benedmunds/CodeIgniter-Ion-Auth @.> Cc: Moutlou @.>; Author @.> Subject: Re: [benedmunds/CodeIgniter-Ion-Auth] Controllers\Auth Line: 583 $this->data['message'] = $this->validation->getErrors() ? ..... (#1508)

Sorry, I'm not quite following. Is this as issue with what validation->getErrors() is returning into $data['message']? Which version of Ion Auth and CI are you using?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/benedmunds/CodeIgniter-Ion-Auth/issues/1508#issuecomment-812571454 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AQG7DPXQBQCJPRUUSGAMJY3TGXNABANCNFSM42HVQESA . https://github.com/notifications/beacon/AQG7DPWVNDDILHKZMBOK5WTTGXNABA5CNFSM42HVQESKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGBXNWPQ.gif

benedmunds commented 3 years ago

Which version of Ion Auth and CI are you using?

moutlou commented 3 years ago

I’m using Codeigniter 4 and IonAuth 4

I’m using it with extending your base class like this

class Authentication extends \IonAuth\Controllers\Auth

without any implementation into mt main class

From: Ben Edmunds @.> Sent: Friday, April 2, 2021 8:47 PM To: benedmunds/CodeIgniter-Ion-Auth @.> Cc: Moutlou @.>; Author @.> Subject: Re: [benedmunds/CodeIgniter-Ion-Auth] Controllers\Auth Line: 583 $this->data['message'] = $this->validation->getErrors() ? ..... (#1508)

Which version of Ion Auth and CI are you using?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/benedmunds/CodeIgniter-Ion-Auth/issues/1508#issuecomment-812637425 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AQG7DPWAGL5GYOSWLTLLVWDTGX7JXANCNFSM42HVQESA . https://github.com/notifications/beacon/AQG7DPVJHI64NYZGQKKVK6TTGX7JXA5CNFSM42HVQESKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGBX5Z4I.gif

benedmunds commented 3 years ago

validation->getErrors() should return as array, not a string... See the CI source here: https://github.com/codeigniter4/CodeIgniter4/blob/develop/system/Validation/Validation.php#L741

If you have an error are you getting an array back? Which commit hash or specific version of CI are you using?

moutlou commented 3 years ago

Hello Ben,

The variable $message with var_dump($message) showed [string(139) “ “] ….

So, I found the problem. The variable $message contains the debug string as hex an it not showing anything.

The debug string is :

” From: Ben Edmunds ***@***.***> Sent: Monday, April 5, 2021 7:21 PM To: benedmunds/CodeIgniter-Ion-Auth ***@***.***> Cc: Moutlou ***@***.***>; Author ***@***.***> Subject: Re: [benedmunds/CodeIgniter-Ion-Auth] Controllers\Auth Line: 583 $this->data['message'] = $this->validation->getErrors() ? ..... (#1508) validation->getErrors() should return as array, not a string... See the CI source here: https://github.com/codeigniter4/CodeIgniter4/blob/develop/system/Validation/Validation.php#L741 If you have an error are you getting an array back? Which commit hash or specific version of CI are you using? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub , or unsubscribe .
benedmunds commented 3 years ago

So it is an empty array? Is there an issue with that?

moutlou commented 3 years ago

No all are ok now Ben

From: Ben Edmunds @.> Sent: Tuesday, April 6, 2021 6:21 PM To: benedmunds/CodeIgniter-Ion-Auth @.> Cc: Moutlou @.>; Author @.> Subject: Re: [benedmunds/CodeIgniter-Ion-Auth] Controllers\Auth Line: 583 $this->data['message'] = $this->validation->getErrors() ? ..... (#1508)

So it is an empty array? Is there an issue with that?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/benedmunds/CodeIgniter-Ion-Auth/issues/1508#issuecomment-814207161 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AQG7DPQCHHYA2OF7HIVOOJTTHMRE7ANCNFSM42HVQESA . https://github.com/notifications/beacon/AQG7DPUUT323V2RZHL6CYU3THMRE7A5CNFSM42HVQESKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGCD5BOI.gif

benedmunds commented 3 years ago

Ok cool. Closing this issue then, thanks!