Commit e7e4f662 authored by Vivek's avatar Vivek

jabberclient: made offline contacts visible. added password reset. updated error handling.

parent c18d9b9e
...@@ -135,14 +135,26 @@ ...@@ -135,14 +135,26 @@
<ul data-role="listview" data-inset="true">\n <ul data-role="listview" data-inset="true">\n
{{#each contact}}\n {{#each contact}}\n
<li>\n <li>\n
{{#if url}}\n {{#if status}}\n
<a href="{{url}}">\n {{#if url}}\n
{{#if new_message}}\n <a href="{{url}}" class="ui-btn ui-btn-icon-left ui-icon-check">\n
<span class="ui-li-count">!</span>\n {{#if new_message}}\n
<span class="ui-li-count">!</span>\n
{{/if}}\n
{{jid}}</a>\n
{{else}}\n
{{jid}}\n
{{/if}}\n {{/if}}\n
{{jid}}</a>\n
{{else}}\n {{else}}\n
{{jid}}\n {{#if url}}\n
<a href="{{url}}" class="ui-btn ui-btn-icon-left ui-icon-forbidden">\n
{{#if new_message}}\n
<span class="ui-li-count">!</span>\n
{{/if}}\n
{{jid}}</a>\n
{{else}}\n
{{jid}}\n
{{/if}}\n
{{/if}}\n {{/if}}\n
</li>\n </li>\n
{{/each}}\n {{/each}}\n
...@@ -207,10 +219,37 @@ ...@@ -207,10 +219,37 @@
</div>\n </div>\n
</script>\n </script>\n
\n \n
<script class="reset-password-template" type="text/x-handlebars-template">\n
<div class="ui-grid-b ui-responsive">\n
<div class="ui-block-a"></div>\n
<div class="ui-block-b">\n
<h2>Reset Password</h2>\n
<form class="reset-password-form">\n
<div class="ui-field-contain">\n
<label>Server URL</label>\n
<input type="text" name="server" placeholder="Server URL" value="tiolive.com" required>\n
</div>\n
<div class="ui-field-contain">\n
<label>New Password</label>\n
<input type="password" name="new_passwd" placeholder="New Password" value="" required>\n
</div>\n
<div class="ui-field-contain">\n
<label>Repeat Password</label>\n
<input type="password" name="repeat_passwd" placeholder="Repeat Password" value="" required>\n
</div>\n
<input data-inline="true" type="submit" value="Submit" data-theme="b">\n
</form>\n
<pre style="white-space: pre-wrap;">{{message}}</pre>\n
</div>\n
<div class="ui-block-c">\n
</div>\n
</div>\n
</script>\n
<script class="message-template" type="text/x-handlebars-template"><li data-theme="{{theme}}" style="{{style}}"><pre style="white-space: pre-wrap;">{{text}}</pre></li></script>\n <script class="message-template" type="text/x-handlebars-template"><li data-theme="{{theme}}" style="{{style}}"><pre style="white-space: pre-wrap;">{{text}}</pre></li></script>\n
\n \n
<script class="history-template" type="text/x-handlebars-template"><pre style="white-space: pre-wrap;">{{text}}</pre></script>\n <script class="history-template" type="text/x-handlebars-template"><pre style="white-space: pre-wrap;">{{text}}</pre></script>\n
\n \n
<script class="error-template" type="text/x-handlebars-template"><pre style="white-space: pre-wrap;">{{error_message}}</pre></script>\n
<script class="header-template" type="text/x-handlebars-template">\n <script class="header-template" type="text/x-handlebars-template">\n
{{#if left_url}}\n {{#if left_url}}\n
<a href="{{left_url}}" class="ui-btn-left ui-btn ui-btn-inline ui-mini ui-corner-all">{{left_title}}</a>\n <a href="{{left_url}}" class="ui-btn-left ui-btn ui-btn-inline ui-mini ui-corner-all">{{left_title}}</a>\n
...@@ -368,7 +407,7 @@ ...@@ -368,7 +407,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>klaus.woelfel</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -382,7 +421,7 @@ ...@@ -382,7 +421,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>942.15924.54448.8823</string> </value> <value> <string>944.5553.6477.32460</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -400,8 +439,8 @@ ...@@ -400,8 +439,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1428669417.76</float> <float>1435739472.1</float>
<string>UTC</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
...@@ -347,45 +347,69 @@ ...@@ -347,45 +347,69 @@
deferServerConnection(this);\n deferServerConnection(this);\n
})\n })\n
\n \n
// .declareMethod(\'fetchRoster\', function () {\n .declareMethod(\'fetchRoster\', function () {\n
// var defer = RSVP.defer();\n var defer = RSVP.defer();\n
// \n function jsonifyResponse(domElt) {\n
// function jsonifyResponse(domElt) {\n try {\n
// try {\n var result = [],\n
// var result = [],\n elt,\n
// elt,\n json_elt,\n
// json_elt,\n len,\n
// len,\n i,\n
// i,\n len2,\n
// len2,\n j,\n
// j,\n item_list = domElt.querySelectorAll("item");\n
// item_list = domElt.querySelectorAll("item");\n len = item_list.length;\n
// len = item_list.length;\n for (i = 0; i < len; i += 1) {\n
// for (i = 0; i < len; i += 1) {\n elt = item_list[i];\n
// elt = item_list[i];\n len2 = elt.attributes.length;\n
// len2 = elt.attributes.length;\n json_elt = {};\n
// json_elt = {};\n for (j = 0; j < len2; j += 1) {\n
// for (j = 0; j < len2; j += 1) {\n json_elt[elt.attributes[j].name] = elt.attributes[j].value;\n
// json_elt[elt.attributes[j].name] = elt.attributes[j].value;\n }\n
// }\n result.push(json_elt);\n
// result.push(json_elt);\n }\n
// }\n defer.resolve(result);\n
// defer.resolve(result);\n } catch (error) {\n
// } catch (error) {\n defer.reject(error);\n
// defer.reject(error);\n }\n
// }\n }\n
// }\n this.props.connection.sendIQ(\n
// \n $iq({type: "get"}).c("query", {xmlns: Strophe.NS.ROSTER}),\n
// this.props.connection.sendIQ(\n jsonifyResponse,\n
// $iq({type: "get"}).c("query", {xmlns: Strophe.NS.ROSTER}),\n defer.reject\n
// jsonifyResponse,\n );\n
// defer.reject\n return defer.promise;\n
// );\n })\n
// \n \n
// return defer.promise;\n .declareMethod(\'resetPassword\', function (server, new_passwd) {\n
// \n var defer = RSVP.defer();\n
// })\n function jsonifyResponse(domElt) {\n
\n try {\n
var result = [],\n
type = domElt.getAttribute(\'type\');\n
if(type === "result") {\n
result.push("Password Reset Success.");\n
}\n
else {\n
throw new Error("Password Reset Failure.");\n
}\n
defer.resolve(result);\n
} catch (error) {\n
defer.reject(error);\n
}\n
}\n
var uid = this.props.jid.split(\'@\')[0];\n
this.props.connection.sendIQ(\n
$iq({to: server, type: "set"})\n
.c("query", {xmlns: "jabber:iq:register"})\n
.c("username").t(uid).up()\n
.c("password").t(new_passwd).up(),\n
jsonifyResponse,\n
defer.reject\n
);\n
return defer.promise;\n
})\n
.declareMethod(\'sendPresence\', function () {\n .declareMethod(\'sendPresence\', function () {\n
this.props.connection.send(\n this.props.connection.send(\n
$pres().tree()\n $pres().tree()\n
...@@ -545,7 +569,7 @@ ...@@ -545,7 +569,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>romain</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -559,7 +583,7 @@ ...@@ -559,7 +583,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>939.33961.3512.52974</string> </value> <value> <string>944.5651.30805.18688</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -577,7 +601,7 @@ ...@@ -577,7 +601,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1418214516.59</float> <float>1435744650.8</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment