fix
This commit is contained in:
parent
3c68bbff1a
commit
45a62b9d54
@ -55,26 +55,16 @@ public class BaseController {
|
|||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the local user.
|
|
||||||
*
|
|
||||||
* @return the local user
|
|
||||||
*/
|
|
||||||
protected LocalUser getLocalUser() {
|
|
||||||
return localUserManager.getByAuth(SecurityContextHolder.getContext().getAuthentication());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the gravity.
|
* Gets the gravity.
|
||||||
*
|
*
|
||||||
* @return the gravity
|
* @return the gravity
|
||||||
*/
|
*/
|
||||||
protected double getGravity() {
|
protected double getGravity() {
|
||||||
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
|
String username = getCurrentUsername();
|
||||||
if (auth != null && auth.isAuthenticated()) {
|
if (username != null) {
|
||||||
LocalUser localUser = localUserManager.getByAuth(auth);
|
LocalUser localUser = localUserManager.getByUsername(username);
|
||||||
if (localUser != null && localUser.getSettings() != null
|
if (localUser.getSettings() != null && localUser.getSettings().containsKey("gravity")) {
|
||||||
&& localUser.getSettings().containsKey("gravity")) {
|
|
||||||
try {
|
try {
|
||||||
return Double.parseDouble(localUser.getSettings().get("gravity"));
|
return Double.parseDouble(localUser.getSettings().get("gravity"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user