Skip to content

Commit 75fc2a8

Browse files
author
Karl Seguin
committed
added before check to load user
1 parent 8c61071 commit 75fc2a8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

app/controllers/BaseController.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ public class BaseController extends Controller {
1818
gsonBuilder.registerTypeAdapter(PagedResult.class, new PagedResultGsonAdapter());
1919
}
2020

21+
@Before
22+
//load the user for the view
23+
private static void loadUser() {
24+
if (session.get("uid") == null || !ObjectId.isValid(session.get("uid"))) { return; }
25+
renderArgs.put("user", User.findById(session.get("uid")));
26+
}
27+
2128
@Util
2229
protected static void signin(User user) {
2330
session.put("uid", user.getId());

0 commit comments

Comments
 (0)