1 | |
package controllers; |
2 | |
|
3 | |
import models.*; |
4 | |
|
5 | 0 | public class Security extends Secure.Security { |
6 | |
|
7 | |
static boolean authentify(String username, String password) { |
8 | 0 | return User.connect(username, password) != null; |
9 | |
} |
10 | |
|
11 | |
static boolean check(String profile) { |
12 | 0 | if("admin".equals(profile)) { |
13 | 0 | return User.find("byEmail", connected()).<User>first().isAdmin; |
14 | |
} |
15 | 0 | return false; |
16 | |
} |
17 | |
|
18 | |
static void onDisconnected() { |
19 | 0 | Application.index(); |
20 | 0 | } |
21 | |
|
22 | |
static void onAuthenticated() { |
23 | 0 | Admin.index(); |
24 | 0 | } |
25 | |
|
26 | |
} |
27 | |
|