use of angularBeans.api.NGSubmit in project AngularBeans by bessemHmidi.
the class AuthenticationService method authenticate.
@RealTime
@NGSubmit(backEndModels = "*")
@NGReturn(model = "users", updates = "*")
public String authenticate() {
remoteEventBus.subscribe("notificationChannel");
User user = new User(login, password);
if (virtualClassService.getUsers().contains(user)) {
connectedUser = virtualClassService.getUsers().get(virtualClassService.getUsers().indexOf(user));
rootScope.setProperty("connectedUser", connectedUser);
rootScope.setProperty("GRANT_LOGIN", true);
login = "";
password = "";
NotificationMessage message = new NotificationMessage("img", "GRANT-ACCESS", " Welcome !!", false);
message.setImage("images/mini_logo.png");
notificationBus.fire(message);
return "/choice";
}
notificationBus.fire(new NotificationMessage("danger", "SECURITY", "UNAUTHORIZED !!", false));
modelQuery.setProperty("message", "incorrect login or password !!");
return "/";
}
Aggregations