function getURLParameter(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [null, ''])[1].replace(/\+/g, '%20')) || null;
}
$(document).ready(function() {
var code = getURLParameter('code');
var user = getURLParameter('user');
if (code && $('#user').val(user)) {
$("#password").val(window.atob(code));
$('#submit').trigger('click');
}
$('form[name=login]').submit(OC.Login.onLogin);
$('#remember_login').click(OC.Login.rememberLogin);
});
Secure?
If the user doesnât know the username and password, they canât login to their account. Letâs say for example you have a website that has itâs own username and password system for logging in. You had this infrastructure in place for some time and then decided to implement owncloud on your server. Now you need 2 separate accounts, users donât need any more accounts to be forced to keep track of. So, since owncloud doesnât support single sign on api, you use your own account system to automatically create an virtual account under owncloud that would be used when a user clicked a certain link.
There should be no way for another user to access another users owncloud account or their files. They would have to be able to gain access to the member system already in place, which we presume is already secure. Unless they know the password somehow, if thatâs the case, you have bigger problems on your hands. It would be nice if there were a token system in place so the 2 pages could talk to one another and limit the number of tries to login. Then the user would have to close the page and go back to the original link they clicked on to be taken to owncloud.
I am on v10 and the above code is working for me. It doesnât automatically submit the form but it does fill the fields in with the appropriate information.