Changeset 2007
- Timestamp:
- 08/15/08 13:43:16 (5 months ago)
- Files:
-
- 1 added
- 6 modified
-
branches/1.0/backend/api/xsite.php (modified) (2 diffs)
-
branches/1.0/backend/models/auth.php (added)
-
branches/1.0/desktop/dojotoolkit/api/_base.js (modified) (2 diffs)
-
branches/1.0/desktop/dojotoolkit/desktop/ui/applets/Twitter.js (modified) (5 diffs)
-
trunk/desktop/dojotoolkit/api/_base.js (modified) (2 diffs)
-
trunk/desktop/dojotoolkit/desktop/ui/applets/Twitter.js (modified) (5 diffs)
-
website/trunk/desktopsite/apps/repository/models.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/backend/api/xsite.php
r1864 r2007 10 10 require("../lib/includes.php"); 11 11 import("models.user"); 12 import("models.auth"); 12 13 import("lib.Json.Json"); 13 14 $user = $User->get_current(); … … 24 25 $p->setMethod(HTTP_REQUEST_METHOD_GET); 25 26 if(isset($params["authinfo"])) { 26 $p->addHeader('Authorization', 'Basic ' . $params["authinfo"]); 27 $auth = $params["authinfo"]; 28 $server = array(); 29 preg_match('(^(?:[^/]+://)?([^/:]+))', $url, $server); 30 if(array_key_exists($auth, "password")) { 31 //create/update the entry in the DB 32 $entries = $Auth->filter(array( 33 appid => $params["appid"], 34 server => $server[1], 35 username => $auth["username"], 36 userid => $user->id 37 )); 38 if(!$entries) 39 { 40 //create 41 $entry = new $Auth(array( 42 appid => $params["appid"], 43 server => $server[1], 44 username => $auth["username"], 45 userid => $user->id, 46 password => $auth["password"], 47 )); 48 } 49 else { 50 //update 51 $entry = $entries[0]; 52 $entry->password = $auth["password"]; 53 } 54 $entry->save(); 55 } 56 else { 57 //fetch password from the db 58 $entries = $Auth->filter(array( 59 appid => $params["appid"], 60 server => $server[1], 61 username => $auth["username"], 62 userid => $user->id 63 )); 64 $entry = $entries[0]; 65 $auth["password"] = $entry->password; 66 } 67 $p->addHeader('Authorization', 'Basic ' . base64_encode($auth["username"].":".$auth["password"])); 27 68 } 28 69 // required for some ajax apis -
branches/1.0/desktop/dojotoolkit/api/_base.js
r1948 r2007 10 10 dojo.require("api.ui"); 11 11 dojo.require("api.Window"); 12 dojo.require("dojox.encoding.base64");13 12 14 13 api.xhr = function(/*dojo.__ioArgs|String*/args) { … … 43 42 } 44 43 if(args.auth) { 45 var b = []; 46 var s = args.auth.username + ":" + args.auth.password; 47 for(var i = 0; i < s.length; ++i){ 48 b.push(s.charCodeAt(i)); 49 } 50 xsiteArgs.authinfo = dojox.encoding.base64.encode(b); 44 xsiteArgs.authinfo = dojo.clone(args.auth); 51 45 } 52 46 args.content["DESKTOP_XSITE_PARAMS"] = dojo.toJson(xsiteArgs); -
branches/1.0/desktop/dojotoolkit/desktop/ui/applets/Twitter.js
r1934 r2007 4 4 dojo.require("dijit.Dialog"); 5 5 dojo.require("dijit.form.Textarea"); 6 dojo.require("dojox.encoding.crypto.Blowfish");7 6 dojo.require("dojox.validate.web"); 8 7 dojo.requireLocalization("desktop.ui", "accountInfo"); … … 22 21 }, 23 22 startup: function() { 24 if(!this.settings.key)25 this.settings.key = dojox.encoding.crypto.Blowfish.encrypt(Math.random(), Math.random());26 23 if(!this.settings.username) 27 24 this.drawLoginForm(); … … 74 71 else { 75 72 var authInfo = { 76 username: dojox.encoding.crypto.Blowfish.decrypt(this.settings.username, this.settings.key), 77 password: dojox.encoding.crypto.Blowfish.decrypt(this.settings.password, this.settings.key) 73 username: this.settings.username 78 74 } 79 75 } … … 91 87 if(!this.settings.username) { 92 88 this.settings = dojo.mixin(this.settings, { 93 username: dojox.encoding.crypto.Blowfish.encrypt(this.loginUi.username.getValue(), this.settings.key), 94 password: dojox.encoding.crypto.Blowfish.encrypt(this.loginUi.password.getValue(), this.settings.key) 89 username: this.loginUi.username.getValue() 95 90 }); 96 91 this.loginUi.username.setValue(""); … … 193 188 }, 194 189 auth: { 195 username: dojox.encoding.crypto.Blowfish.decrypt(this.settings.username, this.settings.key), 196 password: dojox.encoding.crypto.Blowfish.decrypt(this.settings.password, this.settings.key) 190 username: this.settings.username, 197 191 }, 198 192 load: dojo.hitch(this, function() { -
trunk/desktop/dojotoolkit/api/_base.js
r1991 r2007 1 1 dojo.provide("api._base"); 2 2 3 dojo.require("api.flash.flash"); 3 4 dojo.require("api.Console"); 4 5 dojo.require("api.crosstalk"); 5 6 dojo.require("api.Filearea"); 6 7 dojo.require("api.filesystem"); 7 dojo.require("api.Mail");8 8 dojo.require("api.Registry"); 9 9 dojo.require("api.Sound"); 10 10 dojo.require("api.ui"); 11 11 dojo.require("api.Window"); 12 dojo.require("dojox.encoding.base64");13 12 14 13 api.xhr = function(/*dojo.__ioArgs|String*/args) { … … 43 42 } 44 43 if(args.auth) { 45 var b = []; 46 var s = args.auth.username + ":" + args.auth.password; 47 for(var i = 0; i < s.length; ++i){ 48 b.push(s.charCodeAt(i)); 49 } 50 xsiteArgs.authinfo = dojox.encoding.base64.encode(b); 44 xsiteArgs.authinfo = dojo.clone(args.auth); 51 45 } 52 46 args.content["DESKTOP_XSITE_PARAMS"] = dojo.toJson(xsiteArgs); -
trunk/desktop/dojotoolkit/desktop/ui/applets/Twitter.js
r1934 r2007 4 4 dojo.require("dijit.Dialog"); 5 5 dojo.require("dijit.form.Textarea"); 6 dojo.require("dojox.encoding.crypto.Blowfish");7 6 dojo.require("dojox.validate.web"); 8 7 dojo.requireLocalization("desktop.ui", "accountInfo"); … … 22 21 }, 23 22 startup: function() { 24 if(!this.settings.key)25 this.settings.key = dojox.encoding.crypto.Blowfish.encrypt(Math.random(), Math.random());26 23 if(!this.settings.username) 27 24 this.drawLoginForm(); … … 74 71 else { 75 72 var authInfo = { 76 username: dojox.encoding.crypto.Blowfish.decrypt(this.settings.username, this.settings.key), 77 password: dojox.encoding.crypto.Blowfish.decrypt(this.settings.password, this.settings.key) 73 username: this.settings.username 78 74 } 79 75 } … … 91 87 if(!this.settings.username) { 92 88 this.settings = dojo.mixin(this.settings, { 93 username: dojox.encoding.crypto.Blowfish.encrypt(this.loginUi.username.getValue(), this.settings.key), 94 password: dojox.encoding.crypto.Blowfish.encrypt(this.loginUi.password.getValue(), this.settings.key) 89 username: this.loginUi.username.getValue() 95 90 }); 96 91 this.loginUi.username.setValue(""); … … 193 188 }, 194 189 auth: { 195 username: dojox.encoding.crypto.Blowfish.decrypt(this.settings.username, this.settings.key), 196 password: dojox.encoding.crypto.Blowfish.decrypt(this.settings.password, this.settings.key) 190 username: this.settings.username, 197 191 }, 198 192 load: dojo.hitch(this, function() { -
website/trunk/desktopsite/apps/repository/models.py
r2000 r2007 15 15 16 16 class Version(models.Model): 17 package = models.F ireignKey(Package)17 package = models.ForeignKey(Package) 18 18 creation_date = models.DateField(auto_now=True, editable=False) 19 19 name = models.CharField(max_length=100)
