commit
18094370a6
4 changed files with 15 additions and 7 deletions
|
@ -17,6 +17,7 @@ import javax.mail.Session;
|
||||||
import javax.mail.Transport;
|
import javax.mail.Transport;
|
||||||
import javax.mail.internet.InternetAddress;
|
import javax.mail.internet.InternetAddress;
|
||||||
import javax.mail.internet.MimeMessage;
|
import javax.mail.internet.MimeMessage;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -130,6 +131,7 @@ public class FreeMarkerEmailProvider implements EmailProvider {
|
||||||
msg.setSubject(subject);
|
msg.setSubject(subject);
|
||||||
msg.setText(body);
|
msg.setText(body);
|
||||||
msg.saveChanges();
|
msg.saveChanges();
|
||||||
|
msg.setSentDate(new Date());
|
||||||
|
|
||||||
Transport transport = session.getTransport("smtp");
|
Transport transport = session.getTransport("smtp");
|
||||||
if (auth) {
|
if (auth) {
|
||||||
|
|
|
@ -224,6 +224,13 @@ public class RequiredActionsService {
|
||||||
|
|
||||||
audit.clone().event(EventType.UPDATE_PASSWORD).success();
|
audit.clone().event(EventType.UPDATE_PASSWORD).success();
|
||||||
|
|
||||||
|
// Password reset through email won't have an associated session
|
||||||
|
if (accessCode.getSessionState() == null) {
|
||||||
|
UserSessionModel userSession = realm.createUserSession(realm.getUserById(accessCode.getUser().getId()), clientConnection.getRemoteAddr());
|
||||||
|
accessCode.getToken().setSessionState(userSession.getId());
|
||||||
|
audit.session(userSession);
|
||||||
|
}
|
||||||
|
|
||||||
return redirectOauth(user, accessCode);
|
return redirectOauth(user, accessCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,10 +329,7 @@ public class RequiredActionsService {
|
||||||
Set<RequiredAction> requiredActions = new HashSet<RequiredAction>(user.getRequiredActions());
|
Set<RequiredAction> requiredActions = new HashSet<RequiredAction>(user.getRequiredActions());
|
||||||
requiredActions.add(RequiredAction.UPDATE_PASSWORD);
|
requiredActions.add(RequiredAction.UPDATE_PASSWORD);
|
||||||
|
|
||||||
UserSessionModel session = realm.createUserSession(user, clientConnection.getRemoteAddr());
|
AccessCodeEntry accessCode = tokenManager.createAccessCode(scopeParam, state, redirect, realm, client, user, null);
|
||||||
audit.session(session);
|
|
||||||
|
|
||||||
AccessCodeEntry accessCode = tokenManager.createAccessCode(scopeParam, state, redirect, realm, client, user, session);
|
|
||||||
accessCode.setRequiredActions(requiredActions);
|
accessCode.setRequiredActions(requiredActions);
|
||||||
accessCode.setAuthMethod("form");
|
accessCode.setAuthMethod("form");
|
||||||
accessCode.setUsernameUsed(username);
|
accessCode.setUsernameUsed(username);
|
||||||
|
|
|
@ -42,6 +42,7 @@ import org.keycloak.representations.idm.CredentialRepresentation;
|
||||||
import org.keycloak.services.managers.AccessCodeEntry;
|
import org.keycloak.services.managers.AccessCodeEntry;
|
||||||
import org.keycloak.services.managers.AuthenticationManager;
|
import org.keycloak.services.managers.AuthenticationManager;
|
||||||
import org.keycloak.services.managers.TokenManager;
|
import org.keycloak.services.managers.TokenManager;
|
||||||
|
import org.keycloak.services.util.CookieHelper;
|
||||||
|
|
||||||
import javax.ws.rs.core.Cookie;
|
import javax.ws.rs.core.Cookie;
|
||||||
import javax.ws.rs.core.MultivaluedMap;
|
import javax.ws.rs.core.MultivaluedMap;
|
||||||
|
|
|
@ -7,17 +7,18 @@
|
||||||
<table class="table table-striped table-bordered">
|
<table class="table table-striped table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>From</th>
|
<th>Date</th>
|
||||||
<th>To</th>
|
<th>To</th>
|
||||||
|
<th>From</th>
|
||||||
<th>Subject</th>
|
<th>Subject</th>
|
||||||
<th>Body</th>
|
<th>Body</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tr data-ng-repeat="m in messages|reverse">
|
<tr data-ng-repeat="m in messages|reverse">
|
||||||
<td>{{m.from}}</td>
|
<td>{{m.date|date:'medium'}}</td>
|
||||||
<td>{{m.to}}</td>
|
<td>{{m.to}}</td>
|
||||||
|
<td>{{m.from}}</td>
|
||||||
<td>{{m.subject}}</td>
|
<td>{{m.subject}}</td>
|
||||||
<td><pre>{{m.body}}</pre></td>
|
<td><pre>{{m.body}}</pre></td>
|
||||||
<td>{{m.date|date:'medium'}}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
Loading…
Reference in a new issue