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
fb60f5d5
Commit
fb60f5d5
authored
Aug 19, 2014
by
Thibaut Frain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Manage wrong login or password
parent
eb321967
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
14 deletions
+39
-14
dev/jabberclient_connection/index.html
dev/jabberclient_connection/index.html
+3
-0
dev/jabberclient_connection/jabberclient_connection.js
dev/jabberclient_connection/jabberclient_connection.js
+16
-7
src/jabberclient_connection/index.html
src/jabberclient_connection/index.html
+3
-0
src/jabberclient_connection/jabberclient_connection.js
src/jabberclient_connection/jabberclient_connection.js
+17
-7
No files found.
dev/jabberclient_connection/index.html
View file @
fb60f5d5
...
@@ -31,6 +31,9 @@
...
@@ -31,6 +31,9 @@
<
fieldset
class
=
"
ui-btn-inline
"
>
<
fieldset
class
=
"
ui-btn-inline
"
>
<
input
type
=
"
submit
"
value
=
"
Log In
"
>
<
input
type
=
"
submit
"
value
=
"
Log In
"
>
<
/fieldset
>
<
/fieldset
>
{{
#
if
authfail
}}
<
p
style
=
"
color:red;
"
>
Bad
username
or
password
<
/p
>
{{
/if}
}
<
/form
>
<
/form
>
<
/div
>
<
/div
>
</script>
</script>
...
...
dev/jabberclient_connection/jabberclient_connection.js
View file @
fb60f5d5
...
@@ -10,9 +10,11 @@
...
@@ -10,9 +10,11 @@
function
serializeXML
(
xml
)
{
function
serializeXML
(
xml
)
{
return
new
XMLSerializer
().
serializeToString
(
xml
);
return
new
XMLSerializer
().
serializeToString
(
xml
);
}
}
function
logout
(
gadget
)
{
function
logout
(
gadget
,
authfail
)
{
sessionStorage
.
removeItem
(
"
connection_params
"
);
sessionStorage
.
removeItem
(
"
connection_params
"
);
return
gadget
.
render
();
return
gadget
.
render
({
authfail
:
authfail
});
}
}
function
showLogout
(
gadget
)
{
function
showLogout
(
gadget
)
{
return
new
RSVP
.
Queue
().
push
(
function
()
{
return
new
RSVP
.
Queue
().
push
(
function
()
{
...
@@ -67,7 +69,7 @@
...
@@ -67,7 +69,7 @@
});
});
}
}
function
connectionListener
(
gadget
,
params
)
{
function
connectionListener
(
gadget
,
params
)
{
var
connection
=
new
Strophe
.
Connection
(
params
.
server
),
connection_callback
;
var
connection
=
new
Strophe
.
Connection
(
params
.
server
),
connection_callback
,
authfail
=
false
;
gadget
.
props
.
connection
=
connection
;
gadget
.
props
.
connection
=
connection
;
function
canceller
()
{
function
canceller
()
{
if
(
connection_callback
!==
undefined
)
{
if
(
connection_callback
!==
undefined
)
{
...
@@ -78,10 +80,14 @@
...
@@ -78,10 +80,14 @@
connection_callback
=
function
(
status
)
{
connection_callback
=
function
(
status
)
{
new
RSVP
.
Queue
().
push
(
function
()
{
new
RSVP
.
Queue
().
push
(
function
()
{
if
(
status
===
Strophe
.
Status
.
CONNECTED
)
{
if
(
status
===
Strophe
.
Status
.
CONNECTED
)
{
authfail
=
false
;
return
login
(
gadget
,
params
);
return
login
(
gadget
,
params
);
}
}
if
(
status
===
Strophe
.
Status
.
DISCONNECTED
)
{
if
(
status
===
Strophe
.
Status
.
DISCONNECTED
)
{
return
logout
(
gadget
);
return
logout
(
gadget
,
authfail
);
}
if
(
status
===
Strophe
.
Status
.
CONNFAIL
||
status
===
Strophe
.
Status
.
AUTHFAIL
)
{
authfail
=
true
;
}
}
}).
fail
(
function
(
e
)
{
}).
fail
(
function
(
e
)
{
reject
(
e
);
reject
(
e
);
...
@@ -91,11 +97,14 @@
...
@@ -91,11 +97,14 @@
}
}
return
new
RSVP
.
Promise
(
resolver
,
canceller
);
return
new
RSVP
.
Promise
(
resolver
,
canceller
);
}
}
function
showLogin
(
gadget
)
{
function
showLogin
(
gadget
,
options
)
{
var
params
=
{
var
params
=
{
server
:
"
https://mail.tiolive.com/chat/http-bind/
"
server
:
"
https://mail.tiolive.com/chat/http-bind/
"
};
};
return
new
RSVP
.
Queue
().
push
(
function
()
{
return
new
RSVP
.
Queue
().
push
(
function
()
{
if
(
options
&&
options
.
authfail
)
{
params
.
authfail
=
true
;
}
$
(
gadget
.
__element
).
html
(
login_template
(
params
));
$
(
gadget
.
__element
).
html
(
login_template
(
params
));
}).
push
(
function
()
{
}).
push
(
function
()
{
return
promiseEventListener
(
gadget
.
__element
.
querySelector
(
"
form.login-form
"
),
"
submit
"
,
false
);
return
promiseEventListener
(
gadget
.
__element
.
querySelector
(
"
form.login-form
"
),
"
submit
"
,
false
);
...
@@ -126,10 +135,10 @@
...
@@ -126,10 +135,10 @@
}
}
}).
ready
(
function
(
g
)
{
}).
ready
(
function
(
g
)
{
g
.
props
=
{};
g
.
props
=
{};
}).
declareMethod
(
"
render
"
,
function
()
{
}).
declareMethod
(
"
render
"
,
function
(
options
)
{
if
(
this
.
props
.
connection
&&
this
.
props
.
connection
.
authenticated
)
{
if
(
this
.
props
.
connection
&&
this
.
props
.
connection
.
authenticated
)
{
return
showLogout
(
this
);
return
showLogout
(
this
);
}
}
return
showLogin
(
this
);
return
showLogin
(
this
,
options
);
});
});
})(
$
,
Strophe
,
rJS
,
Handlebars
);
})(
$
,
Strophe
,
rJS
,
Handlebars
);
\ No newline at end of file
src/jabberclient_connection/index.html
View file @
fb60f5d5
...
@@ -31,6 +31,9 @@
...
@@ -31,6 +31,9 @@
<
fieldset
class
=
"
ui-btn-inline
"
>
<
fieldset
class
=
"
ui-btn-inline
"
>
<
input
type
=
"
submit
"
value
=
"
Log In
"
>
<
input
type
=
"
submit
"
value
=
"
Log In
"
>
<
/fieldset
>
<
/fieldset
>
{{
#
if
authfail
}}
<
p
style
=
"
color:red;
"
>
Bad
username
or
password
<
/p
>
{{
/if}
}
<
/form
>
<
/form
>
<
/div
>
<
/div
>
</script>
</script>
...
...
src/jabberclient_connection/jabberclient_connection.js
View file @
fb60f5d5
...
@@ -22,9 +22,9 @@
...
@@ -22,9 +22,9 @@
return
new
XMLSerializer
().
serializeToString
(
xml
);
return
new
XMLSerializer
().
serializeToString
(
xml
);
}
}
function
logout
(
gadget
)
{
function
logout
(
gadget
,
authfail
)
{
sessionStorage
.
removeItem
(
"
connection_params
"
);
sessionStorage
.
removeItem
(
"
connection_params
"
);
return
gadget
.
render
();
return
gadget
.
render
(
{
authfail
:
authfail
}
);
}
}
function
showLogout
(
gadget
)
{
function
showLogout
(
gadget
)
{
...
@@ -101,7 +101,9 @@
...
@@ -101,7 +101,9 @@
function
connectionListener
(
gadget
,
params
)
{
function
connectionListener
(
gadget
,
params
)
{
var
connection
=
new
Strophe
.
Connection
(
params
.
server
),
var
connection
=
new
Strophe
.
Connection
(
params
.
server
),
connection_callback
;
connection_callback
,
authfail
=
false
;
gadget
.
props
.
connection
=
connection
;
gadget
.
props
.
connection
=
connection
;
function
canceller
()
{
function
canceller
()
{
...
@@ -115,10 +117,15 @@
...
@@ -115,10 +117,15 @@
new
RSVP
.
Queue
()
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
if
(
status
===
Strophe
.
Status
.
CONNECTED
)
{
if
(
status
===
Strophe
.
Status
.
CONNECTED
)
{
authfail
=
false
;
return
login
(
gadget
,
params
);
return
login
(
gadget
,
params
);
}
}
if
(
status
===
Strophe
.
Status
.
DISCONNECTED
)
{
if
(
status
===
Strophe
.
Status
.
DISCONNECTED
)
{
return
logout
(
gadget
);
return
logout
(
gadget
,
authfail
);
}
if
(
status
===
Strophe
.
Status
.
CONNFAIL
||
status
===
Strophe
.
Status
.
AUTHFAIL
)
{
authfail
=
true
;
}
}
})
})
.
fail
(
function
(
e
)
{
.
fail
(
function
(
e
)
{
...
@@ -130,12 +137,15 @@
...
@@ -130,12 +137,15 @@
return
new
RSVP
.
Promise
(
resolver
,
canceller
);
return
new
RSVP
.
Promise
(
resolver
,
canceller
);
}
}
function
showLogin
(
gadget
)
{
function
showLogin
(
gadget
,
options
)
{
var
params
=
{
var
params
=
{
server
:
"
https://mail.tiolive.com/chat/http-bind/
"
server
:
"
https://mail.tiolive.com/chat/http-bind/
"
};
};
return
new
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
if
(
options
&&
options
.
authfail
)
{
params
.
authfail
=
true
;
}
$
(
gadget
.
__element
).
html
(
login_template
(
params
));
$
(
gadget
.
__element
).
html
(
login_template
(
params
));
})
})
.
push
(
function
()
{
.
push
(
function
()
{
...
@@ -198,11 +208,11 @@
...
@@ -198,11 +208,11 @@
g
.
props
=
{};
g
.
props
=
{};
})
})
.
declareMethod
(
'
render
'
,
function
()
{
.
declareMethod
(
'
render
'
,
function
(
options
)
{
if
(
this
.
props
.
connection
&&
if
(
this
.
props
.
connection
&&
this
.
props
.
connection
.
authenticated
)
{
this
.
props
.
connection
.
authenticated
)
{
return
showLogout
(
this
);
return
showLogout
(
this
);
}
}
return
showLogin
(
this
);
return
showLogin
(
this
,
options
);
});
});
}(
$
,
Strophe
,
rJS
,
Handlebars
));
}(
$
,
Strophe
,
rJS
,
Handlebars
));
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