Page 1 of 1

Play music in webbrowser without logon

PostPosted: Sun Dec 04, 2011 9:31 pm
by alfenkillz
Hi,

is there any way to get rid of the Logon screen, so people can play music directly in their web browser without having to logon.

but only play music, not change any settings?

Any help would be appreciated.

Re: Play music in webbrowser without logon

PostPosted: Tue Jan 03, 2012 12:09 am
by ytechie
There is a way. It requires you to change the login.jsp file.

First, you'll want to create a user that isn't able to edit settings or password.
Make sure all of your settings are as you want them because they will be hard to change once you enable the auto-login.

Locate the login.jsp file, and add this function:

Code: Select all
function init() {
      document.getElementById('j_username').value = "guestUserHere";
      document.getElementById('j_password').value = "guestPasswordHere";
      document.getElementById('submit').click();
   }


Next you have to add "id="j_password"" to the password field, and "id="submit"" to the submit button.

The final step is to change the onload= in the body tag to "onload="init()" and save the file.

Every user will automatically be logged in as the user you specified, and to make changes at a later time, you will want to simply comment the last line of the function we added, make your changes, and uncomment the line.

Hope this helps!

Re: Play music in webbrowser without logon

PostPosted: Tue Jan 10, 2012 10:22 am
by alfenkillz
Hi,

Thanks alot, it was very effective!

=)

Re: Play music in webbrowser without logon

PostPosted: Tue Jan 10, 2012 4:58 pm
by bluetooth
Perhaps an easier method is to just put the username and password in the url shortcut
http://yourhost/subsonic/login.view?use ... word=guest
Just replace whatever username / password you like, make sure the guest has the privileges you want and there you go.

Re: Play music in webbrowser without logon

PostPosted: Tue Jan 10, 2012 8:45 pm
by ytechie
bluetooth wrote:Perhaps an easier method is to just put the username and password in the url shortcut
http://yourhost/subsonic/login.view?use ... word=guest
Just replace whatever username / password you like, make sure the guest has the privileges you want and there you go.


But that means you have to set the url to include all the information.

With the method I provided, the root url logs in without any user interaction, and the url does not need to be modified.
:mrgreen:

Re: Play music in webbrowser without logon

PostPosted: Tue Jan 10, 2012 8:48 pm
by bluetooth
Always good to have a choice.

Re: Play music in webbrowser without logon

PostPosted: Tue Jan 10, 2012 8:52 pm
by ytechie
bluetooth wrote:Always good to have a choice.


Absolutely! Thanks for showing us the other way to do an auto login.

With the more complicated way, you can hand out the url (http://[subsonic]) and the user is logged in!
No need to set up a bookmark containing the login info. :D

Re: Play music in webbrowser without logon

PostPosted: Tue Jan 17, 2012 10:47 am
by chugmonkey
ytechie wrote:With the method I provided, the root url logs in without any user interaction, and the url does not need to be modified.


Interesting method ytechie. I would suggest that modifying Sindre's code for stuff like this is actually not the best way to go about making life easier for public login. In this case, I think you would be better off rewriting the URL using the application configuration for whichever J2EE server you're using, perhaps by using J2EE UrlRewriteFilter. This would enable you to have a URL for sharing like http://subsonic/free_pass which wouldn't need amending in the next SS release.

If you would like step by step guidance on implementing this, please let me know.

Cheers

Re: Play music in webbrowser without logon

PostPosted: Tue Jan 17, 2012 4:11 pm
by ytechie
I don't think that would be easier at all. Not for what the OP wanted. Either way, can you post your method so I can check it out for future use?

Re: Play music in webbrowser without logon

PostPosted: Wed Jan 18, 2012 1:49 pm
by chugmonkey
ytechie wrote:can you post your method so I can check it out for future use?


Absolutely - I'll draw it up this weekend. It can also be done in Apache, arguably much more easily. Is there anywhere we can see some stats on what server setup people have got?

Re: Play music in webbrowser without logon

PostPosted: Wed Jan 18, 2012 1:51 pm
by ytechie
Yea. Take a look: viewtopic.php?f=5&t=7147.

Thanks for the info! (In the future.) I would love to know how to make separate urls for different things. I'm guessing it's the same concept as what the /share/[random] does?