1
0

login.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * Copyright (c) 2015
  3. * Vincent Petry <pvince81@owncloud.com>
  4. * Jan-Christoph Borchardt, http://jancborchardt.net
  5. * This file is licensed under the Affero General Public License version 3 or later.
  6. * See the COPYING-README file.
  7. */
  8. /**
  9. * @namespace
  10. * @memberOf OC
  11. * @private
  12. */
  13. OC.Login = _.extend(OC.Login || {}, {
  14. onLogin: function () {
  15. // Only if password reset form is not active
  16. if($('form[name=login][action]').length === 0) {
  17. $('#submit-wrapper .submit-icon')
  18. .removeClass('icon-confirm-white')
  19. .addClass(OCA.Theming && OCA.Theming.inverted
  20. ? 'icon-loading-small'
  21. : 'icon-loading-small-dark');
  22. $('#submit')
  23. .attr('value', t('core', 'Logging in …'));
  24. $('.login-additional').fadeOut();
  25. return true;
  26. }
  27. return false;
  28. },
  29. rememberLogin: function(){
  30. if($(this).is(":checked")){
  31. if($("#user").val() && $("#password").val()) {
  32. $('#submit').trigger('click');
  33. }
  34. }
  35. }
  36. });
  37. $(document).ready(function() {
  38. $('form[name=login]').submit(OC.Login.onLogin);
  39. $('#remember_login').click(OC.Login.rememberLogin);
  40. var clearParamRegex = new RegExp('clear=1');
  41. if (clearParamRegex.test(window.location.href)) {
  42. window.localStorage.clear();
  43. window.sessionStorage.clear();
  44. }
  45. });