Skip to content
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

Add option to replace default flarum login in header with FoF Passport #9

Open
vlntsolo opened this issue Apr 4, 2020 · 1 comment

Comments

@vlntsolo
Copy link
Contributor

vlntsolo commented Apr 4, 2020

One of the applications of this extension might be external user management system for one or more Flarum instances. In this case one might need to hide default Flarum user management modals and restrict authentication to OAuth server only.

It might be handy to have additional boolean setting in extension admin area for this flow.

Front-end forum/index.js can have additional block:

import HeaderSecondary from "flarum/components/HeaderSecondary";
import SettingsPage from "flarum/components/SettingsPage";

app.initializers.add('fof-passport', () => {
 //....
 //Removes Flarum default header signUp logIn links and ads OAuth button
 extend(HeaderSecondary.prototype, 'items', function(items) {
  //If user isn't logged in displays FoF Passport LogIn button
  if (!app.session.user) {
    items.add('fof-passport', LogInButton.component({
        className: 'Button LogInButton--passport',
        icon: app.forum.attribute('fof-passport.loginIcon'),
        path: '/auth/passport',
        children: app.forum.attribute('fof-passport.loginTitle'),
    }));
  }
//Remove Login and signUp buttons
    items.remove("logIn");
    items.remove("signUp");
 });
 //Remove account details change buttons from profile
 extend(SettingsPage.prototype, 'accountItems', function(items) {
   items.remove('changeEmail');
   items.remove('changePassword');
 });

});
@OysterQAQ
Copy link

custom css style to hide default flarum login form

.LogInModal  .Form{
display: none;
}
.LogInModal  .Modal-footer{
display: none;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants