Skip to content

Commit d599835

Browse files
committed
added value on login and register forms with the set_value() function
1 parent b514e5c commit d599835

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/Views/login-view.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
* This is just an example.
55
* To use your view create Views/userlib/login-view.php
66
*/
7-
helper('url');
8-
helper('form_validation');
7+
helper(['url', 'form_validation', 'form']);
98
$loginUrl = url_to('loginurl');
109
$cloudflareSiteKey = "";
1110
?>
1211
<?= \Config\Services::validation()->listErrors() ?>
1312
<form action="<?= $loginUrl ?>" method="post" id="userForm">
14-
<input type="email" name="email" placeholder="Email">
13+
<input type="email" name="email" value="<?= set_value('email') ?>" placeholder="Email">
1514
<input type="password" name="password" placeholder="Password">
1615
<?=
1716
// If you happen to override the login view you should still include the captcha view

src/Views/register-view.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,19 @@
44
* This is just an example.
55
* To use your view create Views/userlib/register-view.php
66
*/
7-
helper('url');
8-
helper('form_validation');
7+
helper(['url', 'form_validation', 'form']);
98
$registerUrl = url_to('registerurl');
109
$cloudflareSiteKey = "";
1110
$config = config(\Franky5831\CodeIgniter4UserLibrary\Config\App::class);
1211
$userExtraAttributes = $config->userExtraAttributes;
1312
?>
1413
<?= \Config\Services::validation()->listErrors() ?>
1514
<form action="<?= $registerUrl ?>" method="post" id="userForm">
16-
<input type="email" name="email" placeholder="Email">
15+
<input type="email" name="email" value="<?= set_value('email') ?>" placeholder="Email">
1716
<input type="password" name="password" placeholder="Password">
1817
<input type="password" name="password_confirm" placeholder="Confirm Password">
1918
<?php foreach ($userExtraAttributes as $attribute => $data): ?>
20-
<input type="<?= $data["type"] ?>" name="<?= $attribute ?>" placeholder="<?= $data["label"] ?>">
19+
<input type="<?= $data["type"] ?>" name="<?= $attribute ?>" value="<?= set_value($attribute) ?>" placeholder="<?= $data["label"] ?>">
2120
<?php endforeach; ?>
2221
<?=
2322
// If you happen to override the register view you should still include the captcha view

0 commit comments

Comments
 (0)