Closed systems-rebooter closed 8 years ago
jQuery did the trick I wanted. In case someone needs the source code:
<script>
function autologin() {
var username = $('#username').val();
var password = $('#password').val();
$.post ('/registration', {'username': username, 'password': password, 'login': 'login'})
.done(function login() { $.post ('/login/', {'username': username, 'password': password, 'login': 'login'}, function() { window.location = '/login/'; })});
};
</script>
Hi guys,
Its not a bug or an actual issue, but rather I need your advice.. Will greatly appreciate if someone from developers can help..
I've added simple registration to CherryMusic with
cherrymusic --adduser
(thanks for this feature @devsnd ;-) ) And now trying to autologin user to CherryMusic after registration. I tried to implement this server side with PHP / Python and Curl (so many at once, since no one working as expected, so I'm testing with all possible variants to find the clue. if would be a programmer, that helped me to resolve the issue much quicker, lol)Getting back to the topic I should mention that since registration already working fine, autologin implementation left before combining both. Autologin almost working, and gives back web-page fine, but then in a second some API issues arising and cherrymusic gives up with errors:
HTML action calling PHP script mentioned below with POST parameters by dummy button pressed ends up with the following:
Cherrymusic
login.html
form structure:Curl example:
PHP example:
Python example:
All of above ^^ gives back Cherrymusic inner HTML, but not login page (so its not auth issue).
Very likely it happens because cherrymusic internal python functions are not callable and returnong
401
status code. Nginx proxy_pass for/api
/res
/serve
prevents from404
file not found errors (such asres/bootstrap3/gen/cherrymusic.css
orres/js/cherrymusic.js
, but internal functions still can't be called.Reverse proxyfing rom nginx.conf:
401 statuses from Nginx log :
200 and 401 statuses from nginx.log
Thanks