ers or if you can build a bridge and get over them.
Now that you have been warned about these common relationship mistakes, you have a much better chance of surviving as a couple!<filename>src/main/java/com/fourthwoods/starter/authentication/UserService.java
package com.fourthwoods.starter.authentication;

import com.fourthwoods.starter.admin.UsernameAlreadyExistsException;
import com.fourthwoods.starter.authorization.Role;
import com.fourthwoods.starter.authorization.RoleService;
import com.fourthwoods.starter.utils.IdGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

@Service
public class UserService implements UserDetailsService {
  final static Logger logger = LoggerFactory.getLogger(UserService.class);

  private UserRepository userRepository;
  private RoleService roleService;
  private BCryptPasswordEncoder passwordEncoder;

  @Autowired
  public UserService(UserRepository userRepository, RoleService roleService, BCryptPasswordEncoder passwordEncoder) {
    this.userRepository = userRepository;
    this.roleService = roleService;
    this.passwordEncoder = passwordEncoder;
  }

  @Transactional
  public User createUser(User user) throws UsernameAlreadyExistsException {
    User newUser = (User)getUserByUsername(user.getUsername());
    if(newUser!= null) {
      throw new UsernameAlreadyExistsException("Username (" + user.getUsername() + ") already exists.");
    }

    newUser = new User();

    newUser.setId(IdGenerator.getId());
    newUser.setUsername(user.getUsername());
    newUser.setPassword(passwordEncoder.encode(user.getPassword()));
    newUser.setPasswordExpired(true);
    newUser.setFirstName(user.getFirstName());
    newUser.setLastName(user.getLastName());
    newUser.setEmail(user.getEmail());

    userRepository.createUser(newUser);

    List<Role> roles = new ArrayList<>();

    for(String role : user.getRoles()) {
      Role r = roleService.getRoleByRole(role);
      roles.add(r);
    }

    if(!roles.isEmpty()) {
      userRepository.updateUserRoles(newUser, roles);
    }

    return getUser(newUser.getId());
  }

  public User getUser(String id) {
    return userRepository.getUser(id);
  }

  public User getUserByUsername(String username) {
    return (User)loadUserByUsername(username);
  }

  @Override
  public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
    User user = null;
    try {
      user = userRepository.getUserByUsername(username);
    } catch(EmptyResultDataAccessException ex) {
      logger.warn(ex.getMessage());
    }

    if(user == null) {
      String message = "Username not found: " + username;
      logger.warn(message);
      throw new UsernameNotFoundException(message);
    }

    return user;
  }

  public List<User> getUsers() {
    return userRepository.getUsers();
  }

  @Transactional
  public User updateUserPassword(User user, String newPassword) {
    User existingUser = userRepository.getUser(user.getId());

    String encodedPassword = passwordEncoder.encode(newPassword);
    existingUser.setPassword(encodedPassword);
    existingUser.setPasswordExpired(false);

    return userRepository.updateUser(existingUser);
  }

  @Transactional
  public User changePassword(User user, String oldPassword, String newPassword) throws IncorrectPasswordException {
    User existingUser = userRepository.getUser(user.getId());
    if(!passwordEncoder.matches(oldPassword, existingUser.getPassword())) {
      throw new IncorrectPasswordException("The user's password is incorrect.");
    }

    String encodedPassword = passwordEncoder.encode(newPassword);
    existingUser.setPassword(encodedPassword);
    existingUser.setPasswordExpired(false);

    return userRepository.updateUser(existingUser);
  }

  public static User getLoggedInUser() {
      Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
      Object principal = null;

      if (authentication!= null) {
          principal = authentication.getPrincipal();
      }

      if (principal!= null && principal instanceof User) {
          return (User)principal;
      }

      return null;
  }
}
Chelsea finishing outside the top four in the Barclays Premier League this season is "unthinkable", according to Marcel Desailly and Graeme Le Saux.
Having bounced back from their worst league run for almost 15 years at the start of 2011, Chelsea have again slumped to fifth in the table after failing to win - or score in - either of their last two games. There are now just 12 matches remaining for the champions to claim a place in the top four.
Speaking at UEFA Headquarters for the official handover of the Champions League trophy to Heineken for its two-month tour of Asia, former France defender Desailly said: "Unthinkable, yes, because they need the Champions League."
Ex-England left-back Le Saux added: "To imagine them not qualifying is unthinkable.
"If they don't finish in the top two or three there'll be reasons for that, which I would think would be quite easy to explain."
Those reasons range from the departure of experienced players in the summer to injuries to key men, the sacking of assistant manager Ray Wilkins and the disruption caused by the record-breaking signings of Fernando Torres and David Luiz.
All this, as well as Ancelotti leading the club to an historic double in his first season at the helm, have made the Chelsea manager more bulletproof than his predecessors, according to Desailly.
"The difference between Ancelotti and the others is that he won (the double)," said Desailly, who nevertheless believes the Italian is not without blame for the club's problems this term.
"He needs to read his players a bit better and fit them into his own tactics."At a friend's house in high school we were watching a movie on her couch. It was one of those wrap around ones. My friends were on the short end facing the stairs and I was laying on the long end facing them. I got a weird feeling like someone was watching us so I look behind me and at the top of the stairs was a small shadow of a child or something staring down at us. Her brother (m19 I think at the time) was autistic and tore his door of the hinges so it was kinda just propped up in the door way in a way the let a small sliver of light from the top corner shine in the hallway up stairs. The shadow covered the light. It didn't move even after we looked away and looked back. It sat there for 5 mins watching us. A year later we were doing the same thing. Sitting in the same spots and everything. I passed out and woke up sitting up looking next to me. There was a massive figure standing over me watching me sleep. According to my friends I sat up repeatedly looking over my shoulder. They didn't see the shadow man but I believe them when they told me what I did. They were terrified when I started screamingimport React from'react';
import styled from'styled-components';
import { primaryColor } from '../vars';
import mapInstance from '../mapInstance';
import once from 'lodash/once';
import emitter from '../uiEmitter';

const Wrapper = styled.div`
  height: 100%;
  width: 100%;
  position: fixed;
`;
const accessToken =
  '<KEY>';

class Map extends React.Component {
  container = React.createRef();

  componentDidMount() {
    const mapboxgl = require('mapbox-gl');
    mapboxgl.accessToken = accessToken;

    this.map = new mapbox