Commit ab7f66d7 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[GATE-156] Extra error messages are now sent to end users who get registration errors.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6870 b35dd754-fafc-0310-a699-88a17e54d16e
parent 8fdd31bc
...@@ -145,6 +145,12 @@ ...@@ -145,6 +145,12 @@
## Added key: 'gateway.base.notloggedin' ## Added key: 'gateway.base.notloggedin'
## Added key: 'gateway.base.enterusername' ## Added key: 'gateway.base.enterusername'
## Added key: 'gateway.web.settings.cancelledchanges' ## Added key: 'gateway.web.settings.cancelledchanges'
##
## 1.0 Beta 7
## Added key: 'gateway.base.registrationdeniedbyacls'
## Added key: 'gateway.base.registrationdeniedbyhost'
## Added key: 'gateway.base.registrationdeniednoacct'
## Added key: 'gateway.base.registrationdeniedbadusername'
# Temporary Tags Until Fixed Properly # Temporary Tags Until Fixed Properly
...@@ -157,6 +163,10 @@ global.save_changes=Save Changes ...@@ -157,6 +163,10 @@ global.save_changes=Save Changes
# Base Transport # Base Transport
gateway.base.notloggedin=You are not currently logged into the {0} transport. gateway.base.notloggedin=You are not currently logged into the {0} transport.
gateway.base.enterusername=Please enter the {0} username of the person you want to add. gateway.base.enterusername=Please enter the {0} username of the person you want to add.
gateway.base.registrationdeniedbyacls=Your registration was denied due to your account not being in the access list.
gateway.base.registrationdeniedbyhost=Your registration was denied due to your account not existing on the same server as the transport.
gateway.base.registrationdeniednoacct=Your registration was denied due to you not having a registered account on the server.
gateway.base.registrationdeniedbadusername=Your registration was denied because the username you provided was not valid for the service.
# OSCAR 'Global' (both AIM/ICQ Transports) # OSCAR 'Global' (both AIM/ICQ Transports)
gateway.oscar.connectionfailed=Connection failed: gateway.oscar.connectionfailed=Connection failed:
......
...@@ -609,6 +609,12 @@ public abstract class BaseTransport implements Component, RosterEventListener { ...@@ -609,6 +609,12 @@ public abstract class BaseTransport implements Component, RosterEventListener {
IQ result = IQ.createResultIQ(packet); IQ result = IQ.createResultIQ(packet);
result.setError(Condition.bad_request); result.setError(Condition.bad_request);
reply.add(result); reply.add(result);
Message em = new Message();
em.setType(Message.Type.error);
em.setTo(packet.getFrom());
em.setFrom(packet.getTo());
em.setBody(LocaleUtils.getLocalizedString("gateway.base.registrationdeniedbyacls", "gateway"));
reply.add(em);
return reply; return reply;
} }
...@@ -664,18 +670,36 @@ public abstract class BaseTransport implements Component, RosterEventListener { ...@@ -664,18 +670,36 @@ public abstract class BaseTransport implements Component, RosterEventListener {
IQ eresult = IQ.createResultIQ(packet); IQ eresult = IQ.createResultIQ(packet);
eresult.setError(Condition.bad_request); eresult.setError(Condition.bad_request);
reply.add(eresult); reply.add(eresult);
Message em = new Message();
em.setType(Message.Type.error);
em.setTo(packet.getFrom());
em.setFrom(packet.getTo());
em.setBody(LocaleUtils.getLocalizedString("gateway.base.registrationdeniednoacct", "gateway"));
reply.add(em);
} }
catch (IllegalAccessException e) { catch (IllegalAccessException e) {
Log.error("Someone who is not a user of this server tried to register with the transport: "+from); Log.error("Someone who is not a user of this server tried to register with the transport: "+from);
IQ eresult = IQ.createResultIQ(packet); IQ eresult = IQ.createResultIQ(packet);
eresult.setError(Condition.not_allowed); eresult.setError(Condition.not_allowed);
reply.add(eresult); reply.add(eresult);
Message em = new Message();
em.setType(Message.Type.error);
em.setTo(packet.getFrom());
em.setFrom(packet.getTo());
em.setBody(LocaleUtils.getLocalizedString("gateway.base.registrationdeniedbyhost", "gateway"));
reply.add(em);
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
Log.error("Someone attempted to register with the gateway with an invalid username: " + from); Log.error("Someone attempted to register with the gateway with an invalid username: " + from);
IQ eresult = IQ.createResultIQ(packet); IQ eresult = IQ.createResultIQ(packet);
eresult.setError(Condition.bad_request); eresult.setError(Condition.bad_request);
reply.add(eresult); reply.add(eresult);
Message em = new Message();
em.setType(Message.Type.error);
em.setTo(packet.getFrom());
em.setFrom(packet.getTo());
em.setBody(LocaleUtils.getLocalizedString("gateway.base.registrationdeniedbadusername", "gateway"));
reply.add(em);
} }
} }
} }
...@@ -701,6 +725,12 @@ public abstract class BaseTransport implements Component, RosterEventListener { ...@@ -701,6 +725,12 @@ public abstract class BaseTransport implements Component, RosterEventListener {
// We want to allow them to change settings if they are already registered. // We want to allow them to change settings if they are already registered.
result.setError(Condition.bad_request); result.setError(Condition.bad_request);
reply.add(result); reply.add(result);
Message em = new Message();
em.setType(Message.Type.error);
em.setTo(packet.getFrom());
em.setFrom(packet.getTo());
em.setBody(LocaleUtils.getLocalizedString("gateway.base.registrationdeniedbyacls", "gateway"));
reply.add(em);
return reply; return reply;
} }
......
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