-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Brand information (registration provider only; #46)
Signed-off-by: Daniele Ricci <[email protected]>
- Loading branch information
1 parent
a0c9b9a
commit 2d7c7a0
Showing
3 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* Kontalk XMPP Tigase extension | ||
* Copyright (C) 2015 Kontalk Devteam <[email protected]> | ||
* Copyright (C) 2017 Kontalk Devteam <[email protected]> | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -659,6 +659,16 @@ private Element prepareSMSResponseForm(String from, PhoneNumberVerificationProvi | |
form.addField(Field.fieldTextSingle("from", from, "Sender ID")); | ||
form.addField(Field.fieldTextSingle("challenge", provider.getChallengeType(), "Challenge type")); | ||
|
||
String brandImage = provider.getBrandImage(); | ||
if (brandImage != null) { | ||
form.addField(Field.fieldTextSingle("brand-image", brandImage, "Brand logo")); | ||
|
||
String brandLink = provider.getBrandLink(); | ||
if (brandLink != null) { | ||
form.addField(Field.fieldTextSingle("brand-link", brandLink, "Brand link")); | ||
} | ||
} | ||
|
||
query.addChild(form.getElement()); | ||
return query; | ||
} | ||
|
51 changes: 51 additions & 0 deletions
51
src/main/java/org/kontalk/xmppserver/registration/BrandedSMSVerificationProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Kontalk XMPP Tigase extension | ||
* Copyright (C) 2017 Kontalk Devteam <[email protected]> | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.kontalk.xmppserver.registration; | ||
|
||
import tigase.db.TigaseDBException; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Base class for a branded SMS verification provider. | ||
* @author Daniele Ricci | ||
*/ | ||
public abstract class BrandedSMSVerificationProvider extends AbstractSMSVerificationProvider { | ||
|
||
protected String brandImage; | ||
protected String brandLink; | ||
|
||
@Override | ||
public void init(Map<String, Object> settings) throws TigaseDBException { | ||
super.init(settings); | ||
brandImage = (String) settings.get("brand-image"); | ||
brandLink = (String) settings.get("brand-link"); | ||
} | ||
|
||
@Override | ||
public String getBrandImage() { | ||
return brandImage; | ||
} | ||
|
||
@Override | ||
public String getBrandLink() { | ||
return brandLink; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* Kontalk XMPP Tigase extension | ||
* Copyright (C) 2015 Kontalk Devteam <[email protected]> | ||
* Copyright (C) 2017 Kontalk Devteam <[email protected]> | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -63,6 +63,17 @@ public RegistrationRequest startVerification(String domain, String phoneNumber) | |
/** Returns true if this provider supports this kind if registration request. */ | ||
public boolean supportsRequest(RegistrationRequest request); | ||
|
||
/** The challenge type implemented by this provider. */ | ||
public String getChallengeType(); | ||
|
||
/** The brand image logo for this provider, if any. */ | ||
public default String getBrandImage() { | ||
return null; | ||
} | ||
|
||
/** The brand link the image logo will point to, if any. */ | ||
public default String getBrandLink() { | ||
return null; | ||
} | ||
|
||
} |