Project

General

Profile

« Previous | Next » 

Revision 49691

View differences:

LoginPage.java
17 17
import eu.dnetlib.gwt.client.MyFormGroup;
18 18
import eu.dnetlib.repo.manager.client.services.UserService;
19 19
import eu.dnetlib.repo.manager.client.services.UserServiceAsync;
20
import eu.dnetlib.repo.manager.shared.Tuple;
20 21
import eu.dnetlib.repo.manager.shared.UserAccessException;
21 22
import org.gwtbootstrap3.client.ui.Alert;
22 23
import org.gwtbootstrap3.client.ui.Anchor;
......
92 93

  
93 94
                } else {
94 95

  
95
                    userService.login(email.getValue(), password.getValue(), new AsyncCallback<UserProfile>() {
96
                    userService.login(email.getValue(), password.getValue(), new AsyncCallback<Tuple<UserProfile, String>>() {
96 97

  
97 98
                        @Override
98 99
                        public void onFailure(Throwable throwable) {
......
111 112
                        }
112 113

  
113 114
                        @Override
114
                        public void onSuccess(UserProfile userProfile) {
115
                        public void onSuccess(Tuple<UserProfile, String> result) {
115 116

  
116
                            RepositoryManager.currentUser = userProfile;
117
                            RepositoryManager.currentUser = result.getFirst();
118
                            RepositoryManager.currentUserRole = result.getSecond();
119

  
117 120
                            Date expireDate = new Date();
118 121
                            CalendarUtil.addDaysToDate(expireDate, 1);
119
                            Cookies.setCookie("currentUser", Crypto.encrypt(userProfile.getEmail()), expireDate);
122
                            Cookies.setCookie("currentUser", Crypto.encrypt(result.getFirst().getEmail()), expireDate);
120 123

  
121 124
                            if (loginListener != null)
122
                                loginListener.loginSucceeded(userProfile);
125
                                loginListener.loginSucceeded(result.getFirst());
123 126
                        }
124 127
                    });
125 128
                }

Also available in: Unified diff