Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
officejs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
officejs
Commits
e7ad8b04
Commit
e7ad8b04
authored
Aug 19, 2011
by
François Billioud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add login from jio
parent
5cea95ba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
10 deletions
+74
-10
UNGProject/js/login.js
UNGProject/js/login.js
+74
-10
No files found.
UNGProject/js/login.js
View file @
e7ad8b04
...
...
@@ -14,22 +14,85 @@ var displayNewAccountForm = function(bool) {
}
}
function
logIntoDav
(
wallet
)
{
var
recall
=
window
.
location
;
window
.
location
.
href
=
wallet
.
storageLocation
+
"
#
"
+
recall
;
}
function
initStorage
(
wallet
)
{
if
(
!
wallet
.
provider
)
{
//local storage
setCurrentStorage
(
new
LocalStorage
(
wallet
.
userName
));
}
else
{
setCurrentStorage
(
new
JIOStorage
(
wallet
));
}
}
//unhosted functions
function
getStorageLocation
(
provider
)
{
//TODO : uses webFinger
return
"
http://
"
+
provider
;
}
function
getApplicationPasswordFromURL
()
{
return
window
.
location
.
href
.
split
(
"
appPwd:
"
)[
1
]
}
function
setWallet
(
newWallet
)
{
localStorage
.
setItem
(
"
wallet
"
,
JSON
.
stringify
(
newWallet
));
}
function
getWallet
()
{
return
JSON
.
parse
(
localStorage
.
getItem
(
"
wallet
"
))
||
null
;
}
var
Wallet
=
function
()
{
this
.
userName
=
$
(
"
input#name
"
).
attr
(
"
value
"
);
this
.
provider
=
$
(
"
input#storage_location
"
).
attr
(
"
value
"
);
this
.
storageLocation
=
getStorageLocation
(
this
.
provider
);
}
/**
*
Log an user with it's Name and ID provider
*
try to log an user after having logged in their Dav account
*/
var
logUser
=
function
()
{
var
name
=
$
(
"
input#name
"
).
attr
(
"
value
"
);
var
IDProvider
=
$
(
"
input#id_provider
"
).
attr
(
"
value
"
);
if
(
name
)
{
setCurrentStorage
(
IDProvider
?
new
JIOStorage
(
name
,
IDProvider
)
:
new
LocalStorage
(
name
));
window
.
location
=
"
ung.html
"
;
function
tryLog
()
{
var
wallet
=
getWallet
();
var
applicationPassword
=
getApplicationPasswordFromURL
();
if
(
applicationPassword
)
{
wallet
.
applicationPassword
=
applicationPassword
;
setWallet
(
wallet
);
//to delete for new registration each time
initStorage
(
wallet
);
waitBeforeSucceed
(
function
()
{
return
getCurrentStorage
().
getUser
();},
function
(){
window
.
location
.
href
=
"
ung.html
"
;});
}
}
/**
* create an account (to use only if UNG is also an ID provider)
* Log an user with it's Name and storage provider
*/
function
logUser
()
{
var
wallet
=
new
Wallet
();
setWallet
(
wallet
);
if
(
!
wallet
.
userName
)
{
return
;}
if
(
wallet
.
provider
)
{
if
(
!
wallet
.
storageLocation
)
{
alert
(
"
unable to find your storage from your provider
"
);
return
;}
if
(
!
wallet
.
applicationPassword
)
{
logIntoDav
(
wallet
);
return
;}
}
initStorage
(
wallet
);
waitBeforeSucceed
(
function
()
{
return
getCurrentStorage
().
getUser
();},
function
(){
window
.
location
.
href
=
"
ung.html
"
;});
}
/**
* create an account (to use only if UNG is also a storage provider)
*/
var
createNewUser
=
function
()
{
function
createNewUser
()
{
var
form
=
$
(
"
form#create-user
"
)[
0
];
/* check that the form is complete */
...
...
@@ -50,7 +113,7 @@ var createNewUser = function() {
/**
* Report an error when filling the form
*/
var
formError
=
function
(
message
)
{
function
formError
(
message
)
{
$
(
"
td#form-message
"
).
attr
(
"
value
"
,
message
);
$
(
"
td#form-message
"
).
css
(
"
display
"
,
"
table-cell
"
);
}
...
...
@@ -64,6 +127,7 @@ function testEMail(email) {
return
regEx
.
test
(
email
);
}
//TODO
function
setFocus
()
{
login
=
document
.
getElementById
(
'
name
'
);
password
=
document
.
getElementById
(
'
password
'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment