Skip to content

Commit fb1dead

Browse files
committed
Return token when sending email
1 parent cdc4826 commit fb1dead

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Core/src/com/infiniteautomation/mango/spring/components/EmailAddressVerificationService.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,18 @@ public void resetKeys() {
119119
*
120120
* @param emailAddress
121121
* @param userToUpdate Optional, may be null
122+
* @param expirationDate Optional, may be null
123+
* @param permissionHolder
124+
* @return The generated token
122125
* @throws TemplateException
123126
* @throws IOException
124127
* @throws AddressException
125128
*/
126-
public void sendVerificationEmail(String emailAddress, User userToUpdate, PermissionHolder permissionHolder) throws TemplateException, IOException, AddressException {
129+
public String sendVerificationEmail(String emailAddress, User userToUpdate, Date expirationDate, PermissionHolder permissionHolder) throws TemplateException, IOException, AddressException {
127130
try {
128-
String token = this.generateToken(emailAddress, userToUpdate, null, permissionHolder);
131+
String token = this.generateToken(emailAddress, userToUpdate, expirationDate, permissionHolder);
129132
this.doSendVerificationEmail(token, userToUpdate);
133+
return token;
130134
} catch (EmailAddressInUseException e) {
131135
if (Permissions.hasAdminPermission(permissionHolder)) {
132136
// rethrow the exception and notify the administrator
@@ -136,6 +140,8 @@ public void sendVerificationEmail(String emailAddress, User userToUpdate, Permis
136140
this.doSendWarningEmail(e.getExistingUser());
137141
}
138142
}
143+
144+
return null;
139145
}
140146

141147
/**
@@ -240,7 +246,7 @@ public URI generateRelativeEmailVerificationUrl(String token) {
240246
* @param tokenString
241247
* @return
242248
*/
243-
public User verifyUserEmail(String tokenString) {
249+
public User updateUserEmailAddress(String tokenString) {
244250
Jws<Claims> token = this.parse(tokenString);
245251
String verifiedEmail = this.verify(token);
246252

@@ -266,7 +272,7 @@ public User verifyUserEmail(String tokenString) {
266272
* @return
267273
* @throws ValidationException
268274
*/
269-
public User publicCreateNewUser(String tokenString, User newUser) throws ValidationException {
275+
public User publicRegisterNewUser(String tokenString, User newUser) throws ValidationException {
270276
this.ensurePublicRegistrationEnabled();
271277

272278
Jws<Claims> token = this.parse(tokenString);

0 commit comments

Comments
 (0)