Port of credentials code from bootstrap cms