Redirect to registration page with values from login box

Hello! I am currently working on a plugin that changes the way you log in, and there are two radio buttons in the login section. One for registered and one for not registered. What I need to do is make it so when you click on the sign in button, and you have the not registered radio button selected then you are redirected to the registration page, and if you had a username in the sign in box, then it would set the value for the username in the registration form reducing the amount of work needed to register. Essentially I need to take the username value they put into the login input box, redirect to the registration page and set the value for the registration username input with what they had in the login username input before they were redirected. I was trying to go about this in javascript, but then I hit a bump when I needed to get the registration url since they could either have pretty urls or not, and I'm not if / how I could check that from the config file in the js function. I was trying to go off of this http://stackoverflow.com/questions/8389646/send-post-data-on-redirect-with-javascript-jquery .
Any help would be appreciated
(I am creating a dynamic Xenforo-esque sliding login menu that will work with any theme. This is the last bump before it is ready to be released. I am also using a custom view for the login section.)
Comments
Update: I managed to stumble upon something that I may be able to use.
http://stackoverflow.com/questions/19036684/jquery-redirect-with-post-data
My only problem is obtaining the url for the registration through js. I'm not sure how I could check if they have pretty urls on or not.
I wouldn't even bother redirecting to the registration form.
Make the button click handler load the registration form AJAX (request
http://forum.example.com/entry/register?DeliveryType=VIEW
) and show it in the popup. Then you can just copy the input values from the signin form to the registration form.Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
@hgtonight ahh I may end up doing that, the only problem is I've changed the popup to a slidedown. Right now I have a custom view that's being rendered so I can change the structure of the login form.
http://puu.sh/h0muU/3504d28c58.png (ignore everything under the sign in button.)
On another note, I'm not entirely sure why I get this but sometimes(barely) I'll get an error when I try to sign in.
http://puu.sh/h0mMP/4c4ed65a45.png
It works again if I hit the back button and login through my form or if I try logging in from there. Any ideas as to why this could be happening?
Ideally what I wanted to happen was have it redirect and fill the values in because I'm not sure if I'd want to have a big form at the top of the page. I may try it but personally I find the redirect to be a lot cleaner of an option.
Slide down, pop up, it is still just an injected DOM element.
That error is due to mangling the transient key.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
@hgtonight How would I get the correct url since this is a plugin? The users can either have pretty urls on or not, is there anyway I could tell without analyzing the url to check in a function? Also what would you recommend to be the correct course of action for what I want to do registration wise? I presume I would want to load the registration via ajax and display it on the main page instead of redirecting (to give it the feel as you are on the registration page and not something that was just added to the login form.) The only problem is I'm trying to make this as dynamic as possible so that's limiting my options. I'd have no way to tell if someone customized the theme layout to tell where the actual container for the categories would be.
And you say I am mangling the transient key, I've searched up a bit on this but I'm not entirely sure how I could fix this. This is my custom view: http://pastebin.com/DH3yYuHw
In case you're wondering I actually took this code from here: http://vanillaforums.org/discussion/23299/login-box-to-frontpage-categories
I am currently looking through here to see if there is something I might be missing since the post was from 2013.
I noticed that entering my website after clearing all the cookies doesn't actually create the session cookie until after I attempt to sign in. How can I make it so the session is created upon entering the site, or how would I go about fixing this? All help would be greatly appreciated. Thanks
Just use the framework's url functions to generate urls. If you are in JS, there is a global
gdn
object that gives you access to the framework.Now
url
has a url in the proper format.If you are in PHP, you can call the Garden Request's Url method to generate URLs and or just use the render functions to generate anchors.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
@hgtonight
oh wow that's awesome, thanks so much. Any ideas on how to fix this?
@hgtonight where / when is the transient key created? I noticed every time I load the sign in page it's created. Is there something I need to add so the Tk is created when you hit the sign in button? The popup class is removed on the sign in button, so if it was related to that, I might need to add the functionality to my new class.
edit: I might be on the right track, I've been looking in embed controller and it seems that it has to deal with cookies.
Update:
I'm not sure if this is the right way to go about it, but I added this inside my function before it renders the login panel. This seemed to work, although I'm not sure if this is the right way to go about it or if this can break something else. Any feedback on this fix would be appreciated.
Gdn::Session()->EnsureTransientKey();
That is probably what you needed to do.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
I'm not sure if this is relevant or not:
stackoverflow.com/questions/4362820/jquery-load-dynamic-image
The password strength meter is controlled via
password.js
, so you will have to add that with your plugin. I would also add theentry,js
file to see if that fixes the captcha issue.Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Surprisingly adding both of those scripts doesn't fix it
. I also added the script for the NoCaptcha Recaptcha, and then fell back to the normal Captcha. I guess I'll have to look into another method of doing this. Thank for all your help
.