Search in sources :

Example 1 with NGSubmit

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 "/";
}
Also used : User(angularBeans.demoApp.domain.User) NotificationMessage(angularBeans.demoApp.domain.NotificationMessage) NGReturn(angularBeans.api.NGReturn) NGSubmit(angularBeans.api.NGSubmit) RealTime(angularBeans.realtime.RealTime)

Aggregations

NGReturn (angularBeans.api.NGReturn)1 NGSubmit (angularBeans.api.NGSubmit)1 NotificationMessage (angularBeans.demoApp.domain.NotificationMessage)1 User (angularBeans.demoApp.domain.User)1 RealTime (angularBeans.realtime.RealTime)1