Skip to content

Update base.rb #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions assets/stylesheets/login.css.redminebuttonstyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#saml-login {
margin: 1em auto 2em auto;
padding: 20px;
width: 340px;
border: 1px solid #FDBF3B;
background-color: #FFEBC1;
border-radius: 4px;
box-sizing: border-box;
}

#saml-login form button[type='submit'] {
display: block;
width: 100%;
}

#saml-login form button[type='submit']:hover {
background-color: #c7c6c5 !important;
}

#login-form table { margin-top: 2em; }
2 changes: 1 addition & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
en:
error_saml_authenticity_error: SAML authentication error
error_saml_invalid_ticket: Invalid SAML ticket
error_saml_invalid_ticket: Invalid SAML ticket (check IDP cert /IDP cert fingerprint)
label_onthefly_creation: Create users automatically?
label_replace_redmine_login: Replace Redmine login page
label_saml_enabled: Enable SAML authentication
Expand Down
2 changes: 1 addition & 1 deletion lib/redmine_saml/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def validated_configuration?
end

def required_attribute_mapping
%i[login firstname lastname mail]
%i[login firstname lastname mail admin]
end

def validate_configuration!
Expand Down
11 changes: 11 additions & 0 deletions lib/redmine_saml/patches/user_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ def find_or_create_from_omniauth(omniauth)
user.login = user_attributes[:login].presence || user_attributes[:mail]
user.language = Setting.default_language
user.activate
if user_attributes[:admin].present?
user.admin = user_attributes[:admin]
else
user.admin = 'false'
end

user.save!
user.reload
end
Expand All @@ -35,6 +41,11 @@ def find_or_create_from_omniauth(omniauth)
user.admin = user_attributes[:admin] if user_attributes[:admin].present?
end

# Debug : check attributes retrueved by the RedmineSaml.user_attributes_from_saml method
# File.write('/tmp/attributes.txt', user_attributes)



RedmineSaml.on_login_callback&.call omniauth, user

user
Expand Down