Permalink
Browse files

Merge pull request #113 from dinsley/master

Client always attempting to connect via SSL problem..
  • Loading branch information...
2 parents d49255a + 049e1b7 commit aa2e0b4ae8eaaab31a27a0b1c52912225a83a16c David Petersen committed May 31, 2012
Showing with 42 additions and 19 deletions.
  1. +6 −0 assets/css/subway.css
  2. +26 −9 assets/js/views/overview.js
  3. +4 −4 lib/irchandler.js
  4. +6 −6 views/templates.jade
View
@@ -8,6 +8,7 @@ html { overflow: hidden; }
position: absolute;
zoom: 1;
padding: 0;
+ font-size: 12px;
}
.container-fluid:before, .container-fluid:after {
display: table;
@@ -109,6 +110,11 @@ html { overflow: hidden; }
background: #434950;
}
+#ssl-self-signed {
+ display: none;
+}
+
+
#user-box div{
padding: 10px 25px;
background: #434950;
@@ -7,7 +7,8 @@ var OverviewView = Backbone.View.extend({
'click #connect-button': 'connect',
'click #login-button': 'login_register',
'click #register-button': 'login_register',
- 'keypress': 'connectOnEnter'
+ 'keypress': 'connectOnEnter',
+ 'click #connect-secure': 'toggle_ssl_options'
},
el: '.content',
@@ -45,32 +46,37 @@ var OverviewView = Backbone.View.extend({
connect: function(event) {
event.preventDefault();
$('.error').removeClass('error');
+
var server = $('#connect-server').val();
var nick = $('#connect-nick').val();
- var port = $('#connect-port').val();
- var secure = $('#connect-secure').val();
- var selfSigned = $('#connect-selfSigned').val();
- var password = $('#connect-password').val();
+ var port = $('#connect-port').val();
+ var secure = $('#connect-secure').is(':checked');
+ var selfSigned = $('#connect-selfSigned').is(':checked');
+ var password = $('#connect-password').val();
+
if (!server) {
$('#connect-server').closest('.clearfix').addClass('error');
$('#connect-server').addClass('error');
}
+
if (!nick) {
$('#connect-nick').closest('.clearfix').addClass('error');
$('#connect-nick').addClass('error');
}
+
if (nick && server) {
$('form').append(ich.load_image());
$('#connect-button').addClass('disabled');
var connectInfo = {
nick: nick,
server: server,
- port: port,
- secure: secure,
- selfSigned: selfSigned,
- password: password
+ port: port,
+ secure: secure,
+ selfSigned: selfSigned,
+ password: password
};
+
irc.me = new User(connectInfo);
irc.me.on('change:nick', irc.appView.renderUserBox);
irc.socket.emit('connect', connectInfo);
@@ -81,16 +87,20 @@ var OverviewView = Backbone.View.extend({
var action = event.target.innerHTML.toLowerCase() || event.action.toLowerCase();
event.preventDefault();
$('.error').removeClass('error');
+
var username = $('#' + action + '-username').val();
var password = $('#' + action + '-password').val();
+
if (!username) {
$('#' + action + '-username').closest('.clearfix').addClass('error');
$('#' + action + '-username').addClass('error');
}
+
if (!password) {
$('#' + action + '-password').closest('.clearfix').addClass('error');
$('#login-password').addClass('error');
}
+
if(username && password){
$('form').append(ich.load_image());
$('#' + action + '-button').addClass('disabled');
@@ -100,6 +110,13 @@ var OverviewView = Backbone.View.extend({
username: username,
password: password
});
+ },
+
+ toggle_ssl_options: function(event) {
+ var port = $('#connect-secure').is(':checked') ? 6697 : 6667
+ $('#connect-port').attr('placeholder', port)
+ $('#ssl-self-signed').toggle();
}
+
});
View
@@ -123,10 +123,10 @@ var irchandler = exports.irchandler = function(socket) {
}
if(client === undefined) {
client = new irc.Client(data.server, data.nick, {
- port: data.port || 6667,
- password: data.password,
- secure: data.secure,
- selfSigned: data.selfSigned,
+ port: data.port || (data.secure ? 6697 : 6667),
+ password: data.password,
+ secure: data.secure,
+ selfSigned: data.selfSigned,
debug: true,
logged_in: false,
showErrors: true,
View
@@ -39,22 +39,22 @@ script(id="overview_connection", type="text/html")
.controls
input#connect-server(type="text")
.control-group
- label(for="connect-nick") Nick
- .controls
- input#connect-nick(type="text")
- .control-group
label(for="connect-port") Port
.controls
- input#connect-port(type="text")
+ input#connect-port.input-small(type="text", placeholder="6667")
.control-group
label(for="connect-secure") SSL
.controls
input#connect-secure(type="checkbox")
- .control-group
+ .control-group#ssl-self-signed
label(for="connect-selfSigned") Self-signed SSL Cert
.controls
input#connect-selfSigned(type="checkbox")
.control-group
+ label(for="connect-nick") Nick
+ .controls
+ input#connect-nick(type="text")
+ .control-group
label(for="connect-password") Password
.controls
input#connect-password(type="password")

0 comments on commit aa2e0b4

Please sign in to comment.