Lines 139-152
Link Here
|
139 |
} |
139 |
} |
140 |
|
140 |
|
141 |
// If we're already logged in, this is a password reset |
141 |
// If we're already logged in, this is a password reset |
142 |
if (session.getStatus() == Session.STATUS_AUTHENTICATED) { |
142 |
if (session.getStatus() == Session.STATUS_AUTHENTICATED |
143 |
response = passwordReset(password, packet, username, session); |
143 |
&& session.getUsername().equalsIgnoreCase( |
|
|
144 |
username)) |
145 |
{ |
146 |
if (password != null |
147 |
&& !password.trim().isEmpty()) |
148 |
{ |
149 |
response = passwordReset(password, packet, |
150 |
username, session); |
151 |
} |
152 |
else |
153 |
{ |
154 |
response = IQ.createResultIQ(packet); |
155 |
response.setError(PacketError.Condition.not_allowed); |
156 |
response.setType(IQ.Type.error); |
157 |
} |
144 |
} |
158 |
} |
145 |
else { |
159 |
else if (session.getStatus() != Session.STATUS_AUTHENTICATED) |
|
|
160 |
{ |
146 |
// it is an auth attempt |
161 |
// it is an auth attempt |
147 |
response = login(username, query, packet, password, session, digest); |
162 |
response = login(username, query, packet, password, session, digest); |
148 |
resourceBound = session.getStatus() == Session.STATUS_AUTHENTICATED; |
163 |
resourceBound = session.getStatus() == Session.STATUS_AUTHENTICATED; |
149 |
} |
164 |
} |
|
|
165 |
else |
166 |
{ |
167 |
throw new UnauthorizedException(); |
168 |
} |
150 |
} |
169 |
} |
151 |
} |
170 |
} |
152 |
} |
171 |
} |