Skip to content
Snippets Groups Projects
Verified Commit 561b26ab authored by Björn Geuken's avatar Björn Geuken Committed by Andrej Shadura
Browse files

[api] DRY code by using existing methods

We already have a method for creating users with fake passwords. Let's
use it.

Cherry-picked from 86473a4b
parent a4ee2f75
No related branches found
No related tags found
1 merge request!21OBS SSO implementation
......@@ -194,14 +194,7 @@ class User < ActiveRecord::Base
end
def self.create_ldap_user(attributes = {})
# Generate and store a 24 char fake pw in the OBS DB that no-one knows
password = SecureRandom.base64
user = User.create(attributes.merge(
password: password,
password_confirmation: password,
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