Welcome Guest, Not a member yet? Register   Sign In
  Myth Auth: number of failed login attempts
Posted by: mpoveda - 07-25-2021, 08:50 PM - Replies (1)

Where is the maximum number of failed login attempts configured?


  Retrieve Model Validation Error Messages with Ajax
Posted by: the_steff - 07-25-2021, 02:54 PM - No Replies

Hello !
I use Codeigniter 4 model with some validation rules and messages using protected $validationRules and $validationMessages (https://codeigniter4.github.io/userguide...ating-data).
I want to retrieve error messages on update but I don't succeed whereas the model respect the rules correctly (no effective update into the database if the rule isn't respected).
I tried this kind of thing in my Controller wich is called by an "ajax-javascript" function :

PHP Code:
(...)
$validation = \Config\Services::validation();
$member_model->update($memberId$data);
log_message("debug",$validation->listErrors());
(...) 
These lines are executed during an ajax call and I'm not trying to reproduce a "classic" php form validation process (view is'nt "recalled", I just echo a state message destinated to javascript ajax initial call). The boolean return value of the update function gives to me the information of succeed or not but I also want to get the message error with it.
Here is what I get when I'm not respecting the model's rule (and then there's no update so it's working, but I just want to retrieve the error message recorded in my model) :
Code:
<!-- DEBUG-VIEW START 1 SYSTEMPATH\Validation\Views\list.php -->

<!-- DEBUG-VIEW ENDED 1 SYSTEMPATH\Validation\Views\list.php -->
I suppose this validation system is directly related to views and html forms. But maybe there's another way to get all benefits of codeigniter model ?
Thanks !

I find the solution (few lines lower in the doc) ....

if ($model->save($data) === false) { return view('updateUser', ['errors' => $model->errors()]); }


Question How handle errors when inserting data?
Posted by: lelolenda - 07-25-2021, 02:41 PM - Replies (6)

Error dump:

mysqli_sql_exception #1062
Duplicate entry 'john' for key 'users.username'

A part of my code:

Code:
$dataUser = [
'username' => $request->getPost('username'),
'email'    => $request->getPost('email'),
'password' => md5($request->getPost('password'))
];

$userModel = new UserModel();

$userModel->insert($dataUser);


  Composer package or module?
Posted by: kleber - 07-25-2021, 01:49 PM - Replies (1)

When to create a composer package and when is it indicated to create a module?


  Ci4 with Docker
Posted by: paliz - 07-24-2021, 01:26 PM - Replies (2)

Hi guy have ever used ci4 with Docker

I just finished my first ci4 app
Basically its backend app and frontend i use it was angular 12

I deployed both of  to the host and work very well

I need to khnow any one works with Docker 

These days in modern app use docker before deployment


  inhibiting image download
Posted by: richb201 - 07-24-2021, 12:03 PM - Replies (2)

I am setting a flag like this in __construct()
$_SESSION['iUploadImage']=0;
Then in _init() I am running
        if ($_SESSION['iUploadImage']==0)  //check to see if already transferred
        {
            $this->MyModel->get_image();  //gets images from s3
            $_SESSION['iUploadImage']=1;  //the files have been transferred
        }

But what I am finding is that $_SESSION['iUploadImage'] keeps getting set back to 0. The goal of this code its to only upload the images once. Any idea why this happens?


  CI4 Session File Handler issue
Posted by: LynxCoder - 07-24-2021, 08:33 AM - Replies (2)

Hi all,
I have a somewhat odd problem with Sessions.  I am using the latest version of CI4, and the session handler in the .ENV is set to use the file handler.

Not every page, but sometimes, (especially if the page is refreshed) I get a Fatal Error....
Fatal error: Uncaught ErrorException: touch(): Unable to create file NULL/ci_session5oabivgbpg3ouudg0op9746292et2ql9

Now if I echo WRITEPATH I get the website root/writable - which is accurate and correct, but the file handler is putting the session files into /public/NULL/ and I am struggling to understand why. I haven't touched or replaced the session handler, nor the path to which it uses.

The writable folder contains a folder called Sessions, which have been chmod'ed to the correct values, but CI isn't using it. Can any one offer any suggestions as to what is happening, and more importantly how to correct it. I have had a search around, but haven't found anything.  If the worst comes to the worst, I'll change to the database handler.

Richie


  Migration problem with 4.1.1 to 4.1.2 and >
Posted by: Vrylx - 07-24-2021, 05:42 AM - Replies (4)

Hi,
I have a migration problem with v 4.1.1 to 4.1.2 and >.
All routing to subfolder of "Controllers" directory fall in 404 (controller or method not found)...
Any idea ?
Error appear since 4.1.2...


  where to download images to ?
Posted by: richb201 - 07-24-2021, 03:52 AM - Replies (2)

I am keeping user's images of documents in an S3 bucket. When they first login I get all of their images and download them to my server. They are getting put into /app/assets/uploads/ etc. I am concerned about keeping user images mixed in with my code. I am using CI3 and Docker. Can anyone recommend a better place to keep user's images and tell me how I can create a path to these files in CI3?


  Ci4 Learn with Myth
Posted by: cuculetea - 07-23-2021, 06:41 AM - Replies (3)

Hello,
This is my first post. I try o learn ci4. I have some big project working on ci3.
Now i have to improve them and also move on ci4.
I have fresh install on centos 8 with composer.
Because i need a complex system admin with roles and many more i decide to use myth. I need to extend Myth because i need to do a phone verification with sms and also mail verification.

I am stuck on how to extend Myth controller with a new method. I don`t want to modify myth\auth\src\controllers\AuthController.php.
I understande i can create app\controllers\AuthController.php but is not working:

PHP Code:
<?php namespace App\Controllers;

use 
Myth\Auth\Controllers\AuthController as MyAuth;

class 
AuthController extends MyAuth
{
  public function pregister() {
echo 
"a";
//return $this->_render($this->config->views['pregister'], ['config' => $this->config]);
}

I also modify 
PHP Code:
public $views = [
 
'login'   => 'Myth\Auth\Views\login',
 
'register' => 'Myth\Auth\Views\register',
 
'pregister' => 'Myth\Auth\Views\register',
 
'forgot'   => 'Myth\Auth\Views\forgot',
 
'reset'   => 'Myth\Auth\Views\reset',
 
'emailForgot' => 'Myth\Auth\Views\emails\forgot',
 
'emailActivation' => 'Myth\Auth\Views\emails\activation',
 ]; 
Why is not working? What i am doind wrong?


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Latest Threads
Query builder question (C...
by bastian
4 minutes ago
Emails has exceeded the m...
by ZoeF
58 minutes ago
PHP 8 - Mailhog and CI 4....
by Chroma
1 hour ago
I can't validate array in...
by paliz
2 hours ago
Filters and $_POST (or $r...
by Kaosweaver
2 hours ago
inhibiting image download
by InsiteFX
3 hours ago
Codeigniter mentioned in ...
by John_Betong
9 hours ago
How handle errors when in...
by wuuyun
Yesterday, 05:47 PM
Ci4 Developer Wanted
by paliz
Yesterday, 02:06 PM
[ASK] Whatsapp Library on...
by ISSHIKI
Yesterday, 11:48 AM

Forum Statistics
» Members: 25,669
» Latest member: rozmaster
» Forum threads: 73,776
» Forum posts: 360,124

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB