I have a form to update user information including username. on the same page, there is a sidebar that has a profile button href="{{route('profile',auth()->user())}}"
once the form is saved I redirect to the same page, the route to update user info is
Route::post('/profile/{user:name}/update' , 'ProfileController#update')->name('update-profile');
so it contains the name ( not the id).
the issue is when the page is redirected back to the same page the profile button is still containing the old user name, which leads to 404. Is there any solution to redirect back and updating the auth user in the sidebar with a new username?
Thank you
That's strange it should normally work. You can do
\Auth::setUser($newUser);
to set a new one.
Related
I have a AjaxFallbackLink to add a product into the wishlist of a customer. When a guest clicks the Link he is redirected to the login page with a RestartResponseAtInterceptPage. After successful login he returned to the first Page. But the URL contains the IBehaviorListener of my "add to wishlist" Link and every Ajax Link does nothing except to reload the page with no changes. I think the problem is the incorrect match of Page instance and BehaviorListener instance because my Page started with instance 1 and returned with instance 4 from Login Page. Everything works when the guest is already logged in.
How can i remove the illegal URL parameter or call the right Link callback to add the product to wishlist after successful login?
I think you need to do the following, in YourApplication#init() add:
getPageSettings().setCallListenerInterfaceAfterExpiry(true)
You can override it per Page if you don't want to enable it globally, see org.apache.wicket.Component#canCallListenerInterfaceAfterExpiry()
In joomla 2.5 user's are taken to predefined page after they have logged-in.
But i need to redirect users to the previous page after they have logged-in, i have tried to search for it every where but i am unable find proper solution explaining what core file i need to modify ?
All you need is an article with a little piece of javascript to browse the history of the user and call the page before the login form. Redirect the user on it on log in.
If you have a menue item (User/Login Form), there is, on the right hand side of the screen, a tab called Basic Options. The first field is called "Login Redirect". Put the article's URL there.
If you use the module: Again in the tab "Basic Options", you can redirect to Any menue item you want, so set a menue item (it has not to be actually showing up somewher) for the article
I am building a wordpress site with this requirement: when the user attempts to navigate to certain pages, they will be forced to fill out a small form (enter their email address) before they can get to the desired page.
On a standalone site, I'd do it like this: on each "protected" page, I'd look for a cookie named "email". If this cookie doesn't exist, redirect to an email capture page, along with a url parameter indicating the page to go to after they enter their email. The email form would call a PHP script that would set the "email" cookie, then redirect to the desired page
How to do this in wordpress? Would I create my cookie testing code in a template and assign that to the protected pages?
Create a template and page for your php code and when user try to navigate to protected pages check for cookie if doesnt exist go to email page (instead it would be fine if the form appears in a pop up window).There when you get the email onsubmit use ajax to go create cookie from php page and once the cookie is set the navigation should take place .you should create a template for the php page ,and give the page id in ajax code
I hope this is what u r looking for.
I want to use the administrator login page as the standard user login page as well. How do I make this the default login page?
For example, my administrator login at: localhost/administrator/index.php is what I want to display when going to: localhost/index.php?option=com_users
Ideally, when a user is not logged in and they go to localhost, I want to redirect to the administrator login page, and then that page will redirect to the Administrator back-end, or the front-end, depending on their credentials.
To do so you need to create a new template, then set up a menu item for your login page and set your newly created template for that menu item.
If you want to copy the code from the actual login page you can find it here:
/administrator/templates/hathor/login.php
Remember to update the paths for any dependencies (eg. CSS files etc) or alternatively copy them to your new template directory.
I have made a website with MVC and I have a little problem on routing: the link addresses from address bar appears with some strange paramaters like:
http://localhost:1413/Account/LogOn?ReturnUrl=%2f
instead of
http://localhost:1413/Account/LogOn
What should I do to have customized addresses.
I don't use any parameters.
The ?ReturnUrl=%2f portion of the Url is added by ASP.NET when a user is automatically redirected to the login page. Its added so that after the user logs in, they can then be redirected to their original page.
In this case, %2f represents the / meaning that the user tried to access the landing page and was subsequently redirected to the logon page. After they login successfully, they will then be redirected to the landing page.
You can still use the http://localhost:1413/Account/LogOn