Properly handle phone numbers

This commit is contained in:
Maxime Dor
2017-08-13 00:16:21 +02:00
parent 5a683b41ef
commit 884583881b
4 changed files with 35 additions and 10 deletions

View File

@@ -60,6 +60,18 @@ public class MappingManager {
return sid;
}
public void validate(String sid, String secret, String token) {
Session s = sessions.get(sid);
if (s == null || !StringUtils.equals(s.secret, secret)) {
throw new BadRequestException("sid or secret are not valid");
}
// TODO actually check token
s.isValidated = true;
s.validationTimestamp = Instant.now();
}
public Optional<ThreePid> getValidated(String sid, String secret) {
Session s = sessions.get(sid);
if (s != null && StringUtils.equals(s.secret, secret)) {