-
Posts
1,306 -
Joined
-
Last visited
-
Days Won
13
Everything posted by Juergen
-
I know with the IP-Settings. But I am little bit aware of it because if people from f.e. the same company try to login and they use the same host -> this could be a problem. Anyway: the chance that this should be happen is marginal. Thanks
-
Thanks Martijn for your answere! But: Attackers often try to user different usernames and passwords and hope that one combination is true. In this case a lots of requests will be send to the server and the server will be busy too. Doesnt it make more sense to create the time limit of next login in any case of false entries to prevent the "bombing" of the server and not only if the username is the same and only the password changes? Best regards
-
I have also the login throttle included in my custom login in form, but it should only work if your are entering the same username with different passwords. I you are entering always a different username and a different password it seems that try and catch method wouldnt count the false logins. Here es the part of the code of the login form. Question: Does try and catch method only works if you are entering the same value in the username field and compare it with the password?? I only got the messages "to wait until xx seconds before next login" if I entered the same username more times. But with different usernames it shows me always that the password and the username doesnt match message (without the time message). Best regards Jürgen
-
Thank you Soma, your solution works perfect. SQL-query: to get stored language and not the current language - this was the idea, but unchaching the user is much better foreach: to grab all links to the profile page in each language and pick out the one which fetches the user language - this was the idea behind it. Best regards
-
I found the solution (thanx to Soma to put me into the right direction) The essential part is to redirect the user in his language to the next page (in this case a profile page where he can update his user information). The main problem was to get the redirection url in the users prefered language. Here is the code I use (this piece of code is in the login page): 1084 is the id of the profile page where I want to redirect. The first step is to make a static call of the db to get the stored user language (not the current of the page!!!!). This is the reason why i dont use the PW api. $data is the variable for the language stored in the users profile (in this case 1011 as the id for the English language) The last step is to create the url for the English version ($profileurl) - it leads to /en/my-profile in my case - this is the path to English profile page. To redirect to this page I use this url in the session. Ready to go. I dont know if this is the perfect solution but it works.
-
So I have to redirect after the login to the profile page in the desired language. Step 1: Call the login page Step 2 Enter your userdata (username and password) Step 3 redirect to the profile page in the users prefered language This is excactly where I am struggling. my redirect code is: if($user->isLoggedin()) $session->redirect($profileurl); I get the $profileurl in this way: $profile = $pages->get(1084); $profileurl = $profile->url; But how can I get the url in the desired language ? Best regards
-
Hello Sergio, thank you for your answere! But: I can get the user language with the direct call of the db. My problem is to trigger the site language in that way. I have created a session and compared it in an if statement like you do, but thats the wrong way. It doesnt work. My code: $user->language->id doesnt influence the site language - thats the main problem. Best regards Jürgen
-
I have setted up a multilingual site with 2 languages (German and English). Goal: If a user logs in in frontend the language would automatically change to his prefered language (entered in his user profile). F.e.: John Smith has English as his prefered language (stored in the language field). The default language of the site is German. So if he logs in, the site language should be changing to English until he logs out. I use the following language switcher in the frontend. <form id="language-switcher" name="language-switcher" class="navbar-form navbar-right" role="form"> <select class='form-control' onchange='window.location=$(this).val();'> <?php foreach($languages as $language) { $selected = ''; // if this page isn't viewable (active) for the language, skip it if(!$page->viewable($language)) continue; // if language is current user's language, make it selected if($user->language->id == $language->id) $selected = " selected=selected"; // determine the "local" URL for this language $url = $page->localUrl($language); // output the option tag echo "<option$selected value='$url'>$language->title</option>"; } ?> </select> </form> This language switcher code is from another entry and works quite well. The problem is that $user->language->id is the current state in the language switcher and not the stored value in John Smiths profile, so it is dynamic and changes every time I activate the language switcher. I can get the stored value with a static call of the db. $loginuser = $user->id; $sql = "SELECT data FROM field_language WHERE pages_id=$loginuser"; $result = wire('db')->query($sql); list($data) = $result->fetch_row(); $userlanguageindb = $data; So the variable $userlanguageindb is the real stored data. So far so good. But how can I influence the site language after the login?? This is my main problem. I would be glad if someone can point me into the right direction. Best regards
-
I have traced the problem down. As Soma pointed out the cause is the save command in the login form. I have tested it with phpmyadmin and the database change is after the login as a cause of the $u->save() process. Here is the solution for this issue from this discussion: https://github.com/ryancramerdesign/ProcessWire/issues/409 First of all download the new file from here: https://github.com/ryancramerdesign/ProcessWire/blob/a411e2523f5f14d2354f40a661e41503595a890a/wire/core/Pages.php Go to wire/core and find the Pages.php. Replace the code with the code downloaded above After this the userlanguage will not change after frontend login. It stays the same in the database. Alternatively, as Soma pointed out too, you can update to 2.5 dev-version, but I have not tested it. Best regards Jürgen
-
Hello Soma, I think I am going to update to the dev-version. Its seems to be the best way in this case. You are right - the second one saves independent if you are logging in with your standard password or your temp password. I only took a look at the first one which is in an if-statement and has no influence by logging in with the standard password. Best regards Jürgen
-
Hello Soma, yes I know that Boostrap has nothing to do with it. But as you can see there is no code in it that makes a save in the database, its only a making of queries against the db, so nothing will be stored in it. I will check the profile template tomorrow (this is where the users will be redirected after the successfull login). I will try to figure out when the moment is where the language will be changed in the db. Best regards Jürgen
-
Yes I am talking about the Bootstrap framework of Twitter and here is the code I use for the login form. I use not the form api of PW because I want to use the Bootstrap markup - this is the reason why the code is such long. I make all the validations via PHP and not with the built in validations of PW (because of the use of Bootstrap ). Best regards Jürgen
-
Thanks for your efforts, yes I use different urls for the pages such as www.mydomain/de/profil/ (German) and www.mydomain/en/profile/ (English). And yes the correct language is set BEFORE the login process and changes after the login in FRONTEND. I made a simple Bootstrap 3 Login form with the fields username and password which redirects after successfull login to the user profile page (FRONTEND). There the user can change several data such as username, email address and so on. Today I will let it as it is, but tomorrow I will try to trace the problem down to its source. Best regards Jürgen
-
Thanks LostKobrakai, no I dont trigger the db ususally in this way. I know that I can make the db-calls like $user->id, $user->pass and so on. I only made this to check if there is an difference (and there were differences without refreshing the page) in the output between the PM-call and the SQL query. I think you are right - there is a bug in the last version as discussed here https://github.com/ryancramerdesign/ProcessWire/issues/409 but I cannot get it to work after the changes I made in the pages.php
-
Sorry, I use PW 2.4 with PHP 5.4 The language of each user ist stored in the table "field_language" and in the row "data". Therefore I have made an standard SQL-query to output the stored user language in the frontend. Code: $loginuser = $user->id;// fe user with the id 41 $sql = "SELECT data FROM field_language WHERE pages_id=$loginuser"; $result = wire('db')->query($sql); list($data) = $result->fetch_row(); $userlanguageindb = $data; echo $userlanguageindb; // gives me the language id for the user This piece of code output the stored language id (in my case 1011 for English) in the frontend template, but this id changes so the default language id must be stored in the db. I think the PW language module is responsible for the issue, because i dont push a submit button to store something in the database.
-
I have searched the forum but I havent found a solution or explaination for this behaviour. I have setted up a multlingual site with English and German (=default). Therefore I have included a language switcher in the frontend which works quite well. In the backend a user can select the language in his profile (in my case English and German). For example a user choose English as his prefered language this value will be stored in the db. PROBLEM: If a user logs in in frontend (not in backend) and he logs out after a while, the user language which is stored in the database will fall back to default (German). So if the user is logging in the next time (in backend or in frontend) - he can see that the language has changed from English to German - THIS IS NOT WHAT I WANT. The stored language in the user profile should be untouched. I dont know why the stored user language value falls back to the default language in the db, but it happens all the time and this drives me crazy. Has anyone an idea how to solve this problem or why this always happens? Best regards Jürgen
-
I have created a new page called "activation.php" where I have all the code for the activation if an user click the link in the email I dont know why but in my case the two lines of code are doing nothing. If I click the activation link, I come to the page but it always shows the error that there is no user in the database with this values. I have not included the functions.php as in your code because I dont know what it should contain. Best regards Jürgen PROBLEM SOLVED I had a mistake by configuring the activation link in the email. I use a multilingual site and therefore the activation link has to include the multilingual page url. In my case: Wrong example: www.my-page.at/activation/?user=testuser&hash=31901670cf14cf4baa816f3fc69e8c7a Correct example: www.my-page.at/de/activation/?user=testuser&hash=31901670cf14cf4baa816f3fc69e8c7a So the language part in the url was missing. Now it works
-
Appending a custom class works fine without the exception of a password field where the password must be entered twice. The class manipulation only works for the first input field in this case. Is there a workaround? I try to create bootstrap forms so it will be necessary to manipulate also the second input field of this field type. Best regards Jürgen
-
Sorry Sakkoulas, I have forgotten to include the index.php. Now it works.
-
@ Sakkoulas But if I do that I am not able to call the variable $wire like "$eventdata=$wire->pages->get('/events/')->children();" like you post. Notice: Undefined variable: wire in /home/.sites/24........ I have tried it but it only works if json-events.php is in the template folder. But if I put it into the template folder, I am not able to call this file directly - I will be redirected. I took a look at your site and it it possible to call your json file via the browser. What could be the cause for this problem?!? Best regards Jürgen
-
Hello Soma, thank you for this explanation. I have always used Joomla and there are a lot of other approaches in creating multilingual site so it was difficult for me to figure out the procedure here in Processwire. Yes, I use the module and I have changed the homepage names to de and en and this makes much more sense. Thank you for your hint. Best regards Jürgen
- 6 replies
-
- language
- multilanguage
-
(and 1 more)
Tagged with:
-
I found the solution This is the example for the fullname. You have to decode it to utf-8: dont use this: Name: $form[fullname] Use this instead: Name:utf8_decode($form[fullname]); Make this for all fields in the email and it works!!
-
Hello Roope, I found out what is the problem, but I could not understand it. Alias is the path name in the settings (home/, startseite/). If I name the English version "home" it doesnt work, but if I name it another name than home it will work. I seems that the word home is protected and could not be used for this purpose. Very strange behaviour. I call it homepage instead of home and now it works quiete well. Thanks for your effort! Best regards Jürgen
- 6 replies
-
- language
- multilanguage
-
(and 1 more)
Tagged with: