Skip to content
Snippets Groups Projects
Commit 86473a4b authored by Björn Geuken's avatar Björn Geuken
Browse files

[api] DRY code by using existing methods

We already have a method for creating users with fake passwords. Let's
use it.
parent b6d9a59f
Branches
No related tags found
No related merge requests found
......@@ -170,12 +170,7 @@ class User < ApplicationRecord
end
def self.create_ldap_user(attributes = {})
user = User.create(attributes.merge(
# Generate and store a 24 char fake pw in the OBS DB that no-one knows
password: SecureRandom.base64,
state: User.default_user_state,
adminnote: "User created via LDAP"
))
user = create_user_with_fake_pw!(attributes.merge(state: default_user_state, adminnote: "User created via LDAP"))
if user.errors.empty?
logger.debug("Created new user...")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment