Token login implemented and postgresql adapted