Sign in to follow this  
Followers 0
modifiedcontent

Something inserts "/processwire/" in my form label

6 posts in this topic

I have a simple front-end password update form like this:

Spoiler

<form method=post id=welcomeform>
<h4>Choose a new password</h4>
	
	<div class=field>
	<label for=pass>New Password</label>
	<input id=pass type=password name=pass placeholder='new password'>
	</div>
	
	<div class=field>
	<label for=pass2>New Password (Confirm)</label>
	<input id=pass2 type=password name=pass_confirm placeholder='new password (confirm)'>
	</div>

	<button type=submit name=welcomeform value='Send'>Set password</button>
</form>

 

In the browser the label of the second field shows up as follows:

Quote

new \processwire\password(confirm)

WTH?!

I can't figure out what is changing the label, what is inserting /processwire/ and reformatting the thing. Is this something in PW? A "helpful" thing that browsers do?

Edit:

The problem disappears if I simply rename the second field to 'Confirm Password'.

So my problem is solved, but I'll leave this here in case this is some kind of bug.

Share this post


Link to post
Share on other sites

fbg13, nothing wrong with the missing quotes. That is valid html and does not explain where the "/processwire/" insert comes from.

Share this post


Link to post
Share on other sites

Valid or not, it is not commonly used and is difficult to read. Nonetheless, it appears you are creating a new password object passing confirm as a parameter. Do you have the namespace set?

Share this post


Link to post
Share on other sites

rick, yeah, well, you know, that's just, like, your opinion, man.

Leaving out quotes where they are not necessary is following the html specs by the letter and makes the html a lot cleaner and easier to read than the common quotes within double-quotes within single quotes mess - my text editor gives the classes and ids their own fun colors.

So I guess something in PW somehow interpreted 'new password (confirm)' as code that it has to do something with, instead of plain placeholder text? That bit was inside quotes btw.

Share this post


Link to post
Share on other sites

I guess it's th file compiler, try to disable it for the template (and clear cache).

1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By jen
      Yesterday we somehow lost access to all current admin, superuser/passwords to processwire.  We tried using the reset password form and nothing was sent.  We began noticing some of the menu buttons went missing as well as some photos.  Any suggestions how to resolve the login issue?
       
       
    • By louisstephens
      I was working on a simple "to-do" style template that has a form on a page. Once the form is submitted, I use the API to  create a new subpage under a pre-existing page, but I notice that it does resubmit the form data (as to be expected) if a user were to refresh the page. Is there a way to prevent this behavior so duplicate content will not be posted by using something like exit(), or is this not proper due to usability?  I guess I am curious as to how other developers handle the same hurdle.
    • By modifiedcontent
      How do you get the same 'set password' form/input fields on the front-end as in the admin area?
      I have a working front-end version, but the admin version has some nifty stuff around it. Should be easy to get the same on the front-end, right?
    • By iNoize
      Hello, 
      i have a landingpage and need to reaname the images or save it to the filed images in the userpage 
      i have this script currently 
       
      if(isset($input->post->submit)) { $lptitle = $sanitizer->text($input->post->lptitle); $anrede = $sanitizer->text($input->post->anrede); $first_name = $sanitizer->text($input->post->first_name); $last_name = $sanitizer->text($input->post->last_name); $str = $sanitizer->text($input->post->str); $num = $sanitizer->text($input->post->num); $plz = $sanitizer->text($input->post->plz); $ort = $sanitizer->text($input->post->ort); $land = $sanitizer->text($input->post->land); $email = $sanitizer->text($input->post->email1); $fbname = $sanitizer->text($input->post->fbname); if ($page->id == '2328' ) { // Set a temporary upload location where the submitted files are stored during form processing $upload_path = $config->paths->assets . "files/stickers/"; // New wire upload $file = new WireUpload('file'); // References the name of the field in the HTML form that uploads the photo $file->setMaxFiles(1); $file->setOverwrite(false); $file->setDestinationPath($upload_path); $file->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif')); // execute upload and check for errors $files = $file->execute(); // echo "Passt"; } // $group = $sanitizer->text($input->post->group2); if ($sanitizer->text($input->post->group2) == "on") { $group = "1"; }else{ $group = "0"; } $mail = \ProcessWire\wiremail(); $mail->to($email)->from("mymailhere@domain.com"); $mail->subject("Deine Anmeldung zur $page->title !"); $mail->bodyHTML("Hey $first_name,<br> <br> deine Anmeldung zur <b style='color: #4fc3f7;'>$page->titleaktion</b> war erfolgreich.<br> $page->mailoben Deine Angaben:<br> $anrede $first_name $last_name<br> $str $num<br> $land - $plz $ort<br> $email<br> $fbname<br> <br> Wir wünschen dir auf jeden Fall schonmal viel Erfolg und erfrischende Grüße!<br> $page->mailunten Gerne kannst du auch deinen Freunden von unserer $page->titleaktion per Facebook, Twitter, Google+, WhatsApp oder E-Mail berichten:<br>"); $mail->send(); $p = new Page(); // create new page object $p->template = 'fans'; // set template $p->parent = $page->id; $p->title = $first_name." ".$last_name."-".$page->numChildren; $p->gender = $anrede; $p->first_name = $first_name; $p->last_name = $last_name; $p->str = $str; $p->num = $num; $p->plz = $plz; $p->ort = $ort; $p->land = $land; $p->email = $email; $p->fbname = $fbname; $p->letter = $group; $p->save(); $p->images = $upload_path . $files[0]; $p->save(); @unlink($upload_path . $files[0]); } How to save the Image to the Userpage  ? 
       
      Thanks 
       
       
       
    • By abdus
      Hey,
      I've been trying to implement some progressive enhancements to take advantage of modern browsers, modern JS and CSS capabilities etc. One thing I've got stuck is to CSRF protection using $session->CSRF.
      I'm echoing hidden token using <?= session()->CSRF->renderInput('contact') ?> inside the form, and I can validate the token with plain POST request (without AJAX) just fine using session()->CSRF->hasValidToken('contact').
      For AJAX, I'm setting headers x-<tokenname>:<tokenvalue>. It shows up in both Chrome DevTools  correctly, and on backend lke HTTP_X_<TOKENNAME> => <TOKEN_VALUE> as expected, so there's no miscommunication. But, when I try to validate it, it fails no matter what.
      After some debugging I realized at each request, a new token is created, which invalidates the one I'm sending. Here are the relevant parts from the core.
      Inside /wire/core/SessionCSRF.php, where validation occurs
      <?php public function hasValidToken($id = '') { $tokenName = $this->getTokenName($id); $tokenValue = $this->getTokenValue($id); // ... if($this->config->ajax && isset($_SERVER["HTTP_X_$tokenName"]) && $_SERVER["HTTP_X_$tokenName"] === $tokenValue) return true; if($this->input->post($tokenName) === $tokenValue) return true; // if this point is reached, token was invalid return false; } it gets token name from here where it checks inside $_SESSION variable
      <?php public function getTokenName($id = '') { $tokenName = $this->session->get($this, "name$id"); // Why can't it find token inside $_SESSION global? if(!$tokenName) { $tokenName = 'TOKEN' . mt_rand() . "X" . time(); // token name always ends with timestamp $this->session->set($this, "name$id", $tokenName); } return $tokenName; } I dont understand why it cannot find correct token and regenerates? Does session not last until browser closes? I can save other data to $session, and get it just fine, am I missing something?