Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JForum
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
Liutauras Vilda
Jeanne Boyarsky
paul wheaton
Sheriffs:
Ron McLeod
Devaka Cooray
Henry Wong
Saloon Keepers:
Tim Holloway
Stephan van Hulst
Carey Brown
Tim Moores
Mikalai Zaikin
Bartenders:
Frits Walraven
Forum:
JForum
Autologin cookies on new user registration
Migrated From Jforum.net
Ranch Hand
Posts: 17424
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
--- src/net/jforum/view/forum/UserAction.java (revision 2451) +++ src/net/jforum/view/forum/UserAction.java (working copy) @@ -251,7 +251,12 @@ + SystemGlobals.getValue(ConfigKeys.SERVLET_EXTENSION)); } else { - this.logNewRegisteredUserIn(newUserId, u); + if (this.request.getParameter("autologin") != null + && SystemGlobals.getBoolValue(ConfigKeys.AUTO_LOGIN_ENABLED)) { + this.logNewRegisteredUserIn(newUserId, u, true); + }else{ + this.logNewRegisteredUserIn(newUserId, u, false); + } } } @@ -269,7 +274,7 @@ if (isOk) { // make account active um.writeUserActive(userId); - this.logNewRegisteredUserIn(userId, u); + this.logNewRegisteredUserIn(userId, u, false); } else { message = I18n.getMessage("User.invalidActivationKey"); @@ -279,7 +284,7 @@ } - private void logNewRegisteredUserIn(int userId, User u) + private void logNewRegisteredUserIn(int userId, User u, boolean shouldSetCookies) { SessionFacade.setAttribute("logged", "1"); @@ -289,6 +294,14 @@ userSession.setUsername(u.getUsername()); userSession.setLastVisit(new Date(System.currentTimeMillis())); userSession.setStartTime(new Date(System.currentTimeMillis())); + + if(shouldSetCookies){ + ControllerUtils.addCookie(SystemGlobals.getValue(ConfigKeys.COOKIE_AUTO_LOGIN), "1"); + ControllerUtils.addCookie(SystemGlobals.getValue(ConfigKeys.COOKIE_USER_HASH), + MD5.crypt(SystemGlobals.getValue(ConfigKeys.USER_HASH_SEQUENCE) + userId)); + ControllerUtils.addCookie(SystemGlobals.getValue(ConfigKeys.COOKIE_NAME_DATA), + Integer.toString(userId)); + } SessionFacade.add(userSession);
To enable, either add a checkbox or a hidden field autologin to the form on templates/default/user_new.htm.
[originally posted on jforum.net by bcc]
Migrated From Jforum.net
Ranch Hand
Posts: 17424
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Could you please add this to jira? We have frozen release 2.1.7 by now, so only bug fixes are being commited.
Thanks.
Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand
Posts: 17424
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Is there a separate id/password there from the forum?
[originally posted on jforum.net by bcc]
Migrated From Jforum.net
Ranch Hand
Posts: 17424
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
bcc wrote:
Is there a separate id/password there from the forum?
yes, you need to register
[originally posted on jforum.net by lazee]
Every snowflake is perfect and unique. And every snowflake contains a very tiny ad.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Ntlm authentication
I want add a new function
Chinese Attached filename can't be shown
Autologin Sample Code
Auto Registration
More...