Просмотр исходного кода

HUE-789 [core] Remove old files from Hue 1

Kept the other ones for historical reason (mini cluster) or the icons
are some are used.
Remove ajax login
Romain Rigaux 13 лет назад
Родитель
Сommit
2e79e3e

+ 4 - 33
desktop/core/src/desktop/auth/views.py

@@ -16,52 +16,23 @@
 # limitations under the License.
 
 import logging
-import threading
 
 import django.contrib.auth.views
-from django.core.exceptions import SuspiciousOperation
-
 from django.core import urlresolvers
-from django.contrib.auth import authenticate, login, get_backends
+from django.core.exceptions import SuspiciousOperation
+from django.contrib.auth import login, get_backends
 from django.contrib.auth.models import User
 from django.contrib.sessions.models import Session
 from django.http import HttpResponseRedirect
+
 from desktop.auth.backend import AllowFirstUserDjangoBackend
-from desktop.lib.django_util import render_json, render
+from desktop.lib.django_util import render
 from desktop.lib.django_util import login_notrequired
 from desktop.log.access import access_warn, last_access_map
 
 LOG = logging.getLogger(__name__)
 
 
-@login_notrequired
-def login_ajax(request):
-  username = request.POST.get('username')
-  user = authenticate(username=username,
-                      password=request.POST.get('password'))
-  if user:
-    access_warn(request, '"%s" login ok' % (user.username,))
-    login(request, user)
-    return render_json(dict(success=True))
-  else:
-    access_warn(request, 'Failed login for user "%s"' % (username,))
-    return render_json(dict(success=False))
-
-
-@login_notrequired
-def login_form(request):
-  """Used by the ajax login"""
-  backends = get_backends()
-  first_login_ever = False
-  for be in backends:
-    if isinstance(be, AllowFirstUserDjangoBackend) and be.is_first_login_ever():
-      first_login_ever = True
-
-  return render("login.html", request,
-                { 'first_login_ever': first_login_ever },
-                force_template=True)
-
-
 def get_current_users():
   """Return dictionary of User objects and
   a dictionary of the user's IP address and last access time"""

+ 4 - 4
desktop/core/src/desktop/auth/views_test.py

@@ -28,16 +28,16 @@ def test_jframe_login():
 
   c = Client()
 
-  response = c.get('/accounts/login_form')
+  response = c.get('/accounts/login/')
   assert_equal(200, response.status_code, "Expected ok status.")
   assert_true(response.context['first_login_ever'])
 
-  response = c.post('/accounts/login_ajax',
+  response = c.post('/accounts/login/',
                     dict(username="foo",
                          password="foo"))
-  assert_equal(200, response.status_code, "Expected ok status.")
+  assert_equal(302, response.status_code, "Expected ok redirect status.")
 
-  response = c.get('/accounts/login_form')
+  response = c.get('/accounts/login/')
   assert_equal(200, response.status_code, "Expected ok status.")
   assert_false(response.context['first_login_ever'])
 

+ 1 - 1
desktop/core/src/desktop/tests.py

@@ -340,7 +340,7 @@ def test_config_check():
 
 def test_last_access_time():
   c = make_logged_in_client(username="access_test")
-  c.post('/accounts/login_ajax')
+  c.post('/accounts/login/')
   login = desktop.auth.views.get_current_users()
   before_access_time = time.time()
   response = c.post('/status_bar')

+ 0 - 2
desktop/core/src/desktop/urls.py

@@ -46,9 +46,7 @@ admin.autodiscover()
 # Some django-wide URLs
 dynamic_patterns = patterns('',
   (r'^accounts/login/$', 'desktop.auth.views.dt_login'),
-  (r'^accounts/login_ajax/?$', 'desktop.auth.views.login_ajax'),
   (r'^accounts/logout/$', 'desktop.auth.views.dt_logout', {'next_page': '/'}),
-  (r'^accounts/login_form/?$', 'desktop.auth.views.login_form'),
   (r'^logs$','desktop.views.log_view'),
   (r'^dump_config$','desktop.views.dump_config'),
   (r'^download_logs$','desktop.views.download_log_view'),

+ 0 - 1
desktop/core/static/js/ThirdParty

@@ -1 +0,0 @@
-../../../../ext/thirdparty/js

+ 0 - 35
desktop/core/static/js/ccs.package.yml

@@ -1,35 +0,0 @@
-copyright: Apache License v2.0
-description: DEPRECATED NAMESPACE REFERENCES FOR CCS JS FILES
-name: ccs-shared
-sources: [
-  Source/Fx/Fx.Shake.js,
-  Source/Deprecated/CCS.Desktop.FlashMessage.js,
-  Source/Deprecated/CCS.JBrowser.js,
-  Source/Deprecated/CCS.JFrame.js,
-  Source/Deprecated/CCS.JFrame.Deprecated.js,
-  Source/Hue/Hue.js,
-  Source/Hue/Hue.Desktop.js,
-  Source/Hue/Hue.Desktop.Config.js,
-  Source/Hue/Hue.Desktop.BackgroundManager.js,
-  Source/Hue/Hue.Dock.js,
-  Source/Hue/Hue.Login.js,
-  Source/Hue/Hue.Request.js,
-  Source/Hue/Hue.SolidWindow.js,
-  Source/Hue/Hue.User.js,
-  Source/Hue/HueChart.js,
-  Source/Hue/HueChart.Box.js,
-  Source/Hue/HueChart.Area.js,
-  Source/Hue/HueChart.Line.js,
-  Source/Hue/HueChart.Circle.js,
-  Source/Hue/HueChart.GroupValueManager.js,
-  Source/UI/StickyWin.UI.Solid.js,
-  Source/UI/ThumbTack.js,
-  Source/JFrameLinkers/Hue.JFrame.Target.js,
-  Source/JFrameLinkers/Hue.JFrame.Chooser.js,
-  Source/JFrameLinkers/Hue.JFrame.ConfirmUnencodeAndPost.js,
-  Source/Native/String.Hue.js,
-  Source/Native/Number.Files.js,
-  Source/StaticThirdParty/DynamicTextarea.js,
-
-]
-version: Unknown

+ 0 - 37
desktop/core/static/js/package.yml

@@ -1,37 +0,0 @@
-copyright: Apache License v2.0
-description: Shared components for Hue
-name: hue-shared
-aliases: ['ccs-shared']
-sources: [
-  Source/Fx/Fx.Shake.js,
-  Source/Deprecated/CCS.Desktop.FlashMessage.js,
-  Source/Deprecated/CCS.JBrowser.js,
-  Source/Deprecated/CCS.JFrame.js,
-  Source/Deprecated/CCS.JFrame.Deprecated.js,
-  Source/Hue/DesktopLoader.js,
-  Source/Hue/Hue.js,
-  Source/Hue/Hue.Desktop.js,
-  Source/Hue/Hue.Desktop.Config.js,
-  Source/Hue/Hue.Desktop.BackgroundManager.js,
-  Source/Hue/Hue.Dock.js,
-  Source/Hue/Hue.Login.js,
-  Source/Hue/Hue.Profiler.js,
-  Source/Hue/Hue.Request.js,
-  Source/Hue/Hue.SolidWindow.js,
-  Source/Hue/Hue.User.js,
-  Source/Hue/HueChart.js,
-  Source/Hue/HueChart.Box.js,
-  Source/Hue/HueChart.Area.js,
-  Source/Hue/HueChart.Line.js,
-  Source/Hue/HueChart.Circle.js,
-  Source/Hue/HueChart.GroupValueManager.js,
-  Source/UI/StickyWin.UI.Solid.js,
-  Source/UI/ThumbTack.js,
-  Source/JFrameLinkers/Hue.JFrame.Target.js,
-  Source/JFrameLinkers/Hue.JFrame.Chooser.js,
-  Source/JFrameLinkers/Hue.JFrame.ConfirmUnencodeAndPost.js,
-  Source/Native/String.Hue.js,
-  Source/Native/Number.Files.js,
-  Source/StaticThirdParty/DynamicTextarea.js,
-]
-version: Unknown

+ 0 - 55
desktop/core/templates/login.html

@@ -1,55 +0,0 @@
-{% comment %}
-Licensed to Cloudera, Inc. under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  Cloudera, Inc. licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-{% endcomment %}
-<div id="hue-flogin">
-  <form action="/accounts/login_ajax" method="post">
-    <img class="hue-login_logo" src="/static/art/hue-login-logo.png" width="61" height="56" alt="Hue Login Logo"/>
-    <input alt="your username" type="text" name="username" class="hue-username" tabIndex="1"/>
-    <img src="/static/art/error.png" width="14" height="14" alt="Error" class="jframe-errorImg"/>
-    <input alt="your password" type="password" name="password" class="hue-password" tabIndex="2" />
-    <input type="submit" class="hue-submit hue-continue" name="continue" value="continue" title="continue"/>
-    <img src="/static/art/login-spinner.gif" class="hue-spinner" width="16" height="16" alt="loading..."/>
-    <img src="/static/art/password-help.png" width="76" height="5" alt="Password Help" id="hue-pwhelp" tabIndex="3">
-  </form>
-</div>
-<div id="hue-restore-option">
-	Restore my last session: <input type="checkbox" checked="true" name="hue-restore-option" value="restore">
-</div>
-<script>
-	//if there is a session to restore, show the option
-	window.addEvent('domready', function(){
-		var option = $('hue-restore-option');
-		option.addEvent('mousedown', function(e){
-			e.stop();
-			if ($(e.target) == option) {
-				var input = option.getElement('input');
-				input.set('checked', !input.get('checked'));
-			}
-		});
-		{%if first_login_ever %}
-			option.hide();
-		{%endif%}
-	});
-</script>
-{%if first_login_ever %}
-  <div id="hue-flogin-first">
-    <p>Since this is your first time logging in,
-    please pick any username and password.</p>
-    <p style="margin-bottom: 0px;"><em>Be sure to remember these, as they
-    will become your superuser account for Hue</em>.</p>
-  </div>
-{% endif %}

+ 0 - 40
desktop/core/templates/registration/login.html

@@ -1,40 +0,0 @@
-{% comment %}
-Licensed to Cloudera, Inc. under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  Cloudera, Inc. licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-{% endcomment %}
-{% block content %}
-
-{% if form.errors %}
-<p>Your username and password didn't match. Please try again.</p>
-{% endif %}
-
-<form method="post" action="{% url django.contrib.auth.views.login %}">
-<table>
-<tr>
-    <td>{{ form.username.label_tag }}</td>
-    <td>{{ form.username }}</td>
-</tr>
-<tr>
-    <td>{{ form.password.label_tag }}</td>
-    <td>{{ form.password }}</td>
-</tr>
-</table>
-
-<input type="submit" value="login" />
-<input type="hidden" name="next" value="{{ next }}" />
-</form>
-
-{% endblock %}

+ 0 - 1
desktop/libs/fancyupload/static/js/Source/FancyUpload

@@ -1 +0,0 @@
-../../../../../../ext/thirdparty/js/digitarald-fancyupload/source/

+ 0 - 16
desktop/libs/fancyupload/static/js/Source/scripts.json

@@ -1,16 +0,0 @@
-{
-	"FancyUpload": {
-		"Swiff.Uploader": {
-			"deps": ["Class.Extras", "Element.Event", "Element.Dimensions", "Swiff"]
-		},
-		"Fx.ProgressBar": {
-			"deps": ["Fx.Transitions", "Element"]
-		},
-		"FancyUpload2": {
-			"deps": ["Swiff.Uploader", "Fx.Tween", "Lang"]
-		},
-		"FancyUpload3.Attach": {
-			"deps": ["Swiff.Uploader", "Element.Style", "Lang", "Fx.ProgressBar", "FancyUpload2"]
-		}
-	}
-}

+ 0 - 1
desktop/libs/mootools-color/static/js/Source/color

@@ -1 +0,0 @@
-.././../../../../../ext/thirdparty/js/mootools-color

+ 0 - 11
desktop/libs/mootools-color/static/js/Source/scripts.json

@@ -1,11 +0,0 @@
-{
-
-	"color": {
-
-		"mootools-color": {
-			"deps": ["Number", "Array"]
-		}
-
-	}
-
-}

+ 0 - 11
desktop/libs/mootools-slick/static/js/Source/scripts.json

@@ -1,11 +0,0 @@
-{
-
-	"slick": {
-
-		"slickparser": {
-			"deps": []
-		}
-
-	}
-
-}

+ 0 - 1
desktop/libs/mootools-slick/static/js/Source/slick

@@ -1 +0,0 @@
-../../../../../../ext/thirdparty/js/slick

+ 0 - 11
desktop/libs/mootools-touch/static/js/Source/scripts.json

@@ -1,11 +0,0 @@
-{
-
-	"touch": {
-
-		"touch": {
-			"deps": ["Class.Extras", "Element"]
-		}
-
-	}
-
-}

+ 0 - 1
desktop/libs/mootools-touch/static/js/Source/touch

@@ -1 +0,0 @@
-../../../../../../ext/thirdparty/js/mootools-touch

+ 0 - 1
desktop/libs/protovis/static/js/Source/moovis

@@ -1 +0,0 @@
-../../../../../../ext/thirdparty/js/moovis

+ 0 - 1
desktop/libs/protovis/static/js/Source/protovis

@@ -1 +0,0 @@
-../../../../../../ext/thirdparty/js/protovis

+ 0 - 24
desktop/libs/protovis/static/js/Source/scripts.json

@@ -1,24 +0,0 @@
-{
-	"protovis": {
-		"protovis-d3.2": {
-			"deps": []
-		}
-	},
-	"moovis" : {
-		"MooVis" : {
-			"deps" : ["Protovis","Protovis.Line","Protovis.Bar","Protovis.Pie"]
-		},
-		"Protovis" : {
-			"deps" : ["protovis-d3.2"]
-		},
-		"Protovis.Line" : {
-			"deps" : ["Protovis"]
-		},
-		"Protovis.Bar" : {
-			"deps" : ["Protovis"]
-		},
-		"Protovis.Pie" : {
-			"deps" : ["Protovis"]
-		}
-	}
-}