Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. I created a workaround - modified the function ```validateForm()``` from `nodebb/public/src/client/register.js` this way:
  2.  
  3. ```
  4. function validateForm(callback) {
  5.  
  6. if (document.getElementById("email").value === "") {
  7. document.getElementById("email").value=makeid().concat(".anonymous.email@mail.localhost");
  8. }
  9. ...
  10. ```
  11.  
  12. Function `makeid()` is from [StackOverflow](http://stackoverflow.com/a/1349426):
  13. ```
  14. function makeid()
  15. {
  16. var text = "";
  17. var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  18.  
  19. for( var i=0; i < 30; i++ )
  20. text += possible.charAt(Math.floor(Math.random() * possible.length));
  21.  
  22. return text;
  23. }
  24. ```
  25. I changed the length of the string from `5` to `30` in order to avoid collisions (probably too much).
  26.  
  27. Additionally, the e-mail field can be hidden with:
  28. ```
  29. document.getElementsByClassName( 'form-group' )[0].style.display="none";
  30. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement