Changing Password

I want to be able to add a function where the user can press a button to change the password. How can I make a function to change the password and for the new 4 digit password to be saved even if the system is reset. I’m using a Lilygo T-RGB that has a ESP32-S3 chip and squarline studio export with arduino v1.1.0

So far I have this code which checks the password input and hides the first pin panel which asks for the current password and then shows the panel where it asks to input new pin

void CheckPin(lv_event_t* e) {
const char* entry = lv_textarea_get_text(ui_TextArea1);
if (strcmp(password, entry) == 0) { // compare entry with password
lv_obj_add_flag(ui_Pin_Panel_1, LV_OBJ_FLAG_HIDDEN);
lv_obj_clear_flag(ui_Pin_Panel_2, LV_OBJ_FLAG_HIDDEN);
}
lv_textarea_set_text(ui_TextArea1, “”); // clear text area after a try
}

It could be done with something like your example function.
You can use the keypad’s ‘READY’ trigger or a dedicated button’s 'CLICKED" trigger on your panel to call this function, by assigning it to ‘CALL_FUNCTION’ action in the event created in SquareLine Studio.
To load/save the passform from your storage system you should use its dedicated file-handling library (like ‘SD’ library for Arduino IDE in case of SD-card storage).